You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4ebd70b
Browse filesBrowse the repository at this point in the historyBrowse files
const pending = await client.query('select exists(select 1 from public.stack127_revalidation_events where next_attempt_at <= now()) as pending');
72
+
if (!pending.rows[0]?.pending) {
73
+
console.log('No due static frontend events.');
74
+
} else {
75
+
leased = (await client.query(`update public.stack127_cache_worker_state set lease_id=$1, lease_until=now()+interval '150 seconds'
76
+
where id and (lease_until is null or lease_until<now()) returning id`, [lease])).rowCount > 0;
77
+
if (leased) {
78
+
const result = await dispatchFrontendRefresh({ repo: process.env.GITHUB_REPOSITORY, token: process.env.GITHUB_TOKEN });
79
+
dispatched = result.dispatched;
80
+
console.log(JSON.stringify(result));
81
+
} else console.log('The cache worker already holds the dispatch lease.');
82
+
}
83
+
} finally {
84
+
try {
85
+
if (leased && !dispatched) await client.query('update public.stack127_cache_worker_state set lease_id=null, lease_until=null where id and lease_id=$1', [lease]);
86
+
} finally { await client.end(); }
87
+
}
88
+
NODE
45
89
- name: Apply the initial cache policy when requested
0 commit comments