mirror of
https://github.com/streamwall/streamwall.git
synced 2026-01-24 14:12:48 -05:00
Add error handling to public data fetching
This commit is contained in:
@@ -14,9 +14,14 @@ export async function* pollPublicData() {
|
||||
const publicDataURL = 'https://woke.net/csv'
|
||||
const refreshInterval = 5 * 60 * 1000
|
||||
while (true) {
|
||||
const resp = await fetch(publicDataURL)
|
||||
const text = await resp.text()
|
||||
const data = await csv().fromString(text)
|
||||
let data
|
||||
try {
|
||||
const resp = await fetch(publicDataURL)
|
||||
const text = await resp.text()
|
||||
data = await csv().fromString(text)
|
||||
} catch (err) {
|
||||
console.warn('error loading stream data', err)
|
||||
}
|
||||
yield filterLive(data)
|
||||
await sleep(refreshInterval)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user