docs: def after_commit(self, session):
          """Any db updates go through here.
  
          We check if any of these models have ``__searchable__`` fields,
          indicating they need to be indexed. With these we update the
          whoosh index for the model. If no index exists, it will be
          created here; this could impose a penalty on the initial commit
          of a model.
          """
          if (
              not self.running
              or session.transaction.nested  # inside a sub-transaction:
              # not yet written in DB
              or session is not db.session()
          ):
              # note: we have not tested too far if session is enclosed in a transaction
              # at connection level. For now it's not a standard use case, it would most
              # likely happens during tests (which don't do that for now)
              return
  
          primary_field = "id"
          state = self.app_state
          items = []
          for op, obj in state.to_update:
              model_name = fqcn(obj.__class__)
              if model_name not in self.adapted or not self.adapted[model_name].indexable:
                  # safeguard
                  continue
  
              # safeguard against DetachedInstanceError
              if sa.orm.object_session(obj) is not None:
                  items.append((op, model_name, getattr(obj, primary_field), {}))
  
          if items:
              index_update.apply_async(kwargs={"index": "default", "items": items})
          self.clear_update_queue()