tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
291
fork
atom
a tool for shared writing and social publishing
291
fork
atom
overview
issues
28
pulls
pipelines
log cursor in appview
awarm.space
6 months ago
cd075704
82fa6c9f
+3
-4
1 changed file
expand all
collapse all
unified
split
appview
index.ts
+3
-4
appview/index.ts
···
20
20
import { createIdentity } from "actions/createIdentity";
21
21
import { drizzle } from "drizzle-orm/node-postgres";
22
22
import { inngest } from "app/api/inngest/client";
23
23
-
import { pool } from "supabase/pool";
24
23
25
24
const cursorFile = process.env.CURSOR_FILE || "/cursor/cursor";
26
25
···
37
36
if (Number.isNaN(startCursor)) startCursor = undefined;
38
37
} catch (e) {}
39
38
40
40
-
const client = await pool.connect();
41
41
-
const db = drizzle(client);
42
39
async function handleEvent(evt: Event) {
43
40
if (evt.event === "identity") {
44
41
if (evt.handle)
···
92
89
});
93
90
94
91
if (error && error.code === "23503") {
92
92
+
let db = drizzle(process.env.DB_URL!);
95
93
await createIdentity(db, { atp_did: evt.did });
96
94
await supabase.from("publications").upsert({
97
95
uri: evt.uri.toString(),
···
232
230
const runner = new MemoryRunner({
233
231
startCursor,
234
232
setCursor: async (cursor) => {
233
233
+
console.log(cursor);
234
234
+
// persist cursor
235
235
await writeFile(cursorFile, cursor.toString());
236
236
-
// persist cursor
237
236
},
238
237
});
239
238
let firehose = new Firehose({