mirror of
https://github.com/streamwall/streamwall.git
synced 2026-04-03 20:32:08 -04: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 publicDataURL = 'https://woke.net/csv'
|
||||||
const refreshInterval = 5 * 60 * 1000
|
const refreshInterval = 5 * 60 * 1000
|
||||||
while (true) {
|
while (true) {
|
||||||
|
let data
|
||||||
|
try {
|
||||||
const resp = await fetch(publicDataURL)
|
const resp = await fetch(publicDataURL)
|
||||||
const text = await resp.text()
|
const text = await resp.text()
|
||||||
const data = await csv().fromString(text)
|
data = await csv().fromString(text)
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('error loading stream data', err)
|
||||||
|
}
|
||||||
yield filterLive(data)
|
yield filterLive(data)
|
||||||
await sleep(refreshInterval)
|
await sleep(refreshInterval)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user