Use posix select combined with pg listen to provide mechanism to wake up sleeping processes
Using the method shown in https:/
The direct motivation for this proposal is to use the new function in alertengine and eventengine so that alertengine runs as soon as possible with respect to new alerts.
Blueprint information
- Status:
- Not started
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- None
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- New
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by
Related branches
Related bugs
Sprints
Whiteboard
Quick mockup implementation that does not handle any DB-errors:
import select
from nav.daemon import safesleep
from nav.db import getConnection
def sleep(timeout, notify=None):
if not notify:
return
connection = getConnection(
cursor = connection.cursor()
cursor.
select.
cursor.
while cursor.
def notify(event):
connection = getConnection(
cursor = connection.cursor()
cursor.
----
Did not know this blueprint existed, but something like this was implemented for the initial prototype of an eventengine rewrite, see https:/