MCPcopy
hub / github.com/psycopg/psycopg / enterabs

Method enterabs

psycopg_pool/psycopg_pool/sched.py:51–64  ·  view source on GitHub ↗

Enter a new task in the queue at an absolute time. Schedule a `!None` to stop the execution.

(self, time: float, action: Callable[[], Any] | None)

Source from the content-addressed store, hash-verified

49 return self.enterabs(time, action)
50
51 def enterabs(self, time: float, action: Callable[[], Any] | None) -> Task:
52 """Enter a new task in the queue at an absolute time.
53
54 Schedule a `!None` to stop the execution.
55 """
56 task = Task(time, action)
57 with self._lock:
58 heappush(self._queue, task)
59 first = self._queue[0] is task
60
61 if first:
62 self._event.set()
63
64 return task
65
66 def run(self) -> None:
67 """Execute the events scheduled."""

Callers 1

enterMethod · 0.95

Calls 2

TaskClass · 0.85
setMethod · 0.45

Tested by

no test coverage detected