Skip to content

Commit

Permalink
WS Notify
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Dec 1, 2023
1 parent 694411a commit bb667bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/components/elements/MarkNotificationRead.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ class MarkNotificationRead extends React.Component {
}

export default connect(null, dispatch => ({
update: (payload) => { /*dispatch({type: 'UPDATE_NOTIFICOUNTERS', payload}) */},
update: (payload) => { dispatch({type: 'UPDATE_NOTIFICOUNTERS', payload}) },
}))(MarkNotificationRead);
30 changes: 15 additions & 15 deletions app/components/elements/NotifyPolling.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ class NotifyPolling extends React.Component {

let subscribeRes
while (true) {
subscribeRes = await counterSubscribeWs(username, async function (err, res) {
if (err) {
console.error(err)
return
}
try {
subscribeRes = await counterSubscribeWs(username, async function (err, res) {
if (err) {
console.error(err)
return
}

if (firstFilled) { // TODO: it is more reliably to use timestamps to check order
await update(res.counters)
}
})
if (firstFilled) { // TODO: it is more reliably to use timestamps to check order
await update(res.counters)
}
})

if (subscribeRes.err) {
console.warning('counterSubscribeWs:', subscribeRes.err, ', retry...')
await delay(2000)
} else {
break
} catch (err) {
console.warn('counterSubscribeWs:', err, ', retry...')
await delay(500)
}
}

Expand All @@ -56,8 +56,8 @@ class NotifyPolling extends React.Component {
let counters
try {
counters = await getNotificationsWs(username)
} catch (error) {
console.error('getNotificationsWs', error)
} catch (err) {
console.error('getNotificationsWs', err)
}

if (counters) {
Expand Down

0 comments on commit bb667bf

Please sign in to comment.