Update src/app/api/events/route.ts
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
This commit is contained in:
parent
6fb9824c11
commit
d1140c9809
1 changed files with 9 additions and 0 deletions
|
|
@ -75,6 +75,15 @@ export async function GET(request: Request): Promise<Response> {
|
||||||
const lastTouchedPath = path.join(projectRoot, '.beads', 'last-touched');
|
const lastTouchedPath = path.join(projectRoot, '.beads', 'last-touched');
|
||||||
let lastTouchedVersion: number | null = null;
|
let lastTouchedVersion: number | null = null;
|
||||||
|
|
||||||
|
let isPolling = false;
|
||||||
|
const pollLastTouched = async () => {
|
||||||
|
if (isPolling) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
isPolling = true;
|
||||||
|
try {
|
||||||
|
const nextVersion = await readLastTouchedVersion(lastTouchedPath);
|
||||||
|
if (nextVersion === null) {
|
||||||
let isPolling = false;
|
let isPolling = false;
|
||||||
const pollLastTouched = async () => {
|
const pollLastTouched = async () => {
|
||||||
if (isPolling) {
|
if (isPolling) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue