mirror of
https://github.com/kennethnym/freya
synced 2026-06-26 03:11:14 +01:00
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>
16 lines
468 B
TypeScript
16 lines
468 B
TypeScript
import { WeatherSource, type WeatherSourceOptions } from "@aelis/source-weatherkit"
|
|
|
|
import type { FeedSourceProvider } from "../session/feed-source-provider.ts"
|
|
|
|
export class WeatherSourceProvider implements FeedSourceProvider {
|
|
private readonly options: WeatherSourceOptions
|
|
|
|
constructor(options: WeatherSourceOptions) {
|
|
this.options = options
|
|
}
|
|
|
|
async feedSourceForUser(_userId: string): Promise<WeatherSource> {
|
|
return new WeatherSource(this.options)
|
|
}
|
|
}
|