MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / checkin

Method checkin

lib/sqlalchemy/pool/base.py:749–770  ·  view source on GitHub ↗
(self, _fairy_was_created: bool = True)

Source from the content-addressed store, hash-verified

747 )
748
749 def checkin(self, _fairy_was_created: bool = True) -> None:
750 if self.fairy_ref is None and _fairy_was_created:
751 # _fairy_was_created is False for the initial get connection phase;
752 # meaning there was no _ConnectionFairy and we must unconditionally
753 # do a checkin.
754 #
755 # otherwise, if fairy_was_created==True, if fairy_ref is None here
756 # that means we were checked in already, so this looks like
757 # a double checkin.
758 util.warn("Double checkin attempted on %s" % self)
759 return
760 self.fairy_ref = None
761 connection = self.dbapi_connection
762 pool = self.__pool
763 while self.finalize_callback:
764 finalizer = self.finalize_callback.pop()
765 if connection is not None:
766 finalizer(connection)
767 if pool.dispatch.checkin:
768 pool.dispatch.checkin(connection, self)
769
770 pool._return_conn(self)
771
772 @property
773 def in_use(self) -> bool:

Callers 2

_checkin_failedMethod · 0.95
_finalize_fairyFunction · 0.45

Calls 3

_return_connMethod · 0.80
warnMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected