openfrontio / openfrontio/OpenFrontIO

[Refactor] Stop mechanism missing in PollingLoop utility

Open
#2,921 6 comments 0 reactions 2 assignees Claimed by @Kronbii View on GitHub
approved Bug Devops
Dominant language
TypeScript
Stars
2.7k
Forks
1.4k
Avg merge
17h 43m
Merged PRs (30d)
310

Description

Describe the bug

The startPolling utility in PollingLoop.ts initiates a recursive setTimeout loop but provides no way to stop it. This causes tasks like
PrivilegeRefresher or Matchmaking to continue polling forever even when the component is logically destroyed or when the server is shutting down.

To Reproduce:

1.Call startPolling with a task.
2.Attempt to stop the polling when it's no longer needed (e.g., during worker shutdown).
3.Observe that the polling continues indefinitely.

Expected behavior:
startPolling
should return a "stop" function or a handle that allows cancellation of the loop.

Desktop:

OS: Arch
Browser: Firefox
Version: Latest
Additional context Affected file:
src/server/PollingLoop.ts

This prevents clean shutdowns and dynamic resource management.
This was sadly introduced by me

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.