webapp: Fix a race that sometimes caused alerts or other notifications to be missed...
authorJoey Hess <joey@kitenet.net>
Wed, 27 Mar 2013 18:56:15 +0000 (14:56 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 27 Mar 2013 18:56:20 +0000 (14:56 -0400)
commit1d0b692198085aa380809105aed37ad3987e8f9f
tree89ab0bc079cc2145c62bca0e0d896756c4b349f5
parenta87e046049f0348c1ae40690ee49a3589663d28c
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.)
Assistant/Threads/DaemonStatus.hs
Assistant/Threads/TransferPoller.hs
Assistant/WebApp.hs
Utility/NotificationBroadcaster.hs
debian/changelog