MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / enqueue

Function enqueue

graph-ui/agents/hooks/atlas-trace.py:42–54  ·  view source on GitHub ↗
(db, project, row)

Source from the content-addressed store, hash-verified

40
41
42def enqueue(db, project, row):
43 # Counter allocation and enqueue are one SQLite transaction: parallel hooks
44 # cannot assign the same run/sequence pair and silently discard an event.
45 with db:
46 db.execute('BEGIN IMMEDIATE')
47 db.execute('INSERT INTO counters VALUES(?,1) ON CONFLICT(run) DO UPDATE SET seq=seq+1',
48 (row['run'],))
49 row['seq'] = db.execute('SELECT seq FROM counters WHERE run=?', (row['run'],)).fetchone()[0]
50 db.execute('INSERT INTO pending(project,payload) VALUES(?,?)',
51 (project, json.dumps(row, ensure_ascii=False)))
52 # A prolonged daemon outage cannot fill the disk without bound. Sequence
53 # gaps remain visible when older undelivered metadata expires.
54 db.execute('DELETE FROM pending WHERE id IN (SELECT id FROM pending ORDER BY id DESC LIMIT -1 OFFSET 10000)')
55
56
57def flush(db):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected