feat(backend): make FeedSourceProvider async (#77)

* feat(backend): make FeedSourceProvider async

Make feedSourceForUser and FeedSourceProviderFn return promises.
Use Promise.allSettled to tolerate partial provider failures.
Guard concurrent getOrCreate calls with in-flight promise dedup.
Return 503 from HTTP handlers when session creation fails.

Co-authored-by: Ona <no-reply@ona.com>

* fix(backend): handle remove() during in-flight session creation

Cancel pending getOrCreate when remove() is called mid-flight.
Destroy the resulting session to prevent it from leaking.

Co-authored-by: Ona <no-reply@ona.com>

---------

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
2026-03-15 22:57:19 +00:00
committed by GitHub
parent 8eedd1f4fd
commit 0b51b97f6c
9 changed files with 255 additions and 76 deletions

View File

@@ -13,7 +13,7 @@ export class TflSourceProvider implements FeedSourceProvider {
this.options = options
}
feedSourceForUser(_userId: string): TflSource {
async feedSourceForUser(_userId: string): Promise<TflSource> {
return new TflSource(this.options)
}
}