Skip to content

Instantly share code, notes, and snippets.

@onosendi
Created June 14, 2023 20:51
Show Gist options
  • Save onosendi/4c775f230a101b20c76cb97f84842945 to your computer and use it in GitHub Desktop.
Save onosendi/4c775f230a101b20c76cb97f84842945 to your computer and use it in GitHub Desktop.
async function foo() {
try {
const { pointer_id } = await db('pointer')
.where({ report: 'foo-report' })
.first();
const data = await db('data').where('id', '>', pointer_id);
const report = makeReport(data);
await db('foo_report').insert(report);
await db('pointer')
.where({ report: 'foo-report' })
.update({ pointer_id: data.at(-1).id });
} catch (e) {
console.trace(e);
}
setTimeout(foo, 1000);
}
foo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment