webapp: Fix a race that sometimes caused alerts or other notifications to be missed if they occurred while a page was loading.
When a page is loaded, the javascript requests an notification url, and does long polling on the url to be informed of changes. But if a change occured before the notification url was requested, it would not be notified of that change, and so the page display would not update. I fixed this by *always* updating the page display after it gets the notification url. This is extra work, but the overhead is not noticable in the other overhead of loading a page. (A nicer way would be to somehow record the version of a page initially loaded, and then compare it with the current version when getting the notification url, and only force an update if it's changed. But getting the "version" of the different parts of the page that use long polling is difficult.)
This commit is contained in:
parent
a87e046049
commit
1d0b692198
5 changed files with 18 additions and 7 deletions
|
@ -30,7 +30,7 @@ waitNotifier getbroadcaster nid = liftAssistant $ do
|
|||
newNotifier :: forall sub. (Assistant NotificationBroadcaster) -> GHandler sub WebApp NotificationId
|
||||
newNotifier getbroadcaster = liftAssistant $ do
|
||||
b <- getbroadcaster
|
||||
liftIO $ notificationHandleToId <$> newNotificationHandle b
|
||||
liftIO $ notificationHandleToId <$> newNotificationHandle True b
|
||||
|
||||
{- Adds the auth parameter as a hidden field on a form. Must be put into
|
||||
- every form. -}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue