MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / checkin

Method checkin

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

Source from the content-addressed store, hash-verified

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