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
3b692e894c
commit
cf5f55d294
1 changed files with 0 additions and 13 deletions
|
|
@ -77,15 +77,6 @@ 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) {
|
||||||
|
|
@ -105,10 +96,6 @@ export async function GET(request: Request): Promise<Response> {
|
||||||
lastTouchedVersion = nextVersion;
|
lastTouchedVersion = nextVersion;
|
||||||
write(toSseFrame(issuesEventBus.emit(projectRoot, lastTouchedPath, 'changed')));
|
write(toSseFrame(issuesEventBus.emit(projectRoot, lastTouchedPath, 'changed')));
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
isPolling = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const touchedPoll = setInterval(() => {
|
const touchedPoll = setInterval(() => {
|
||||||
void pollLastTouched();
|
void pollLastTouched();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue