From 9b18dc2a394560d6a6f39b61e1155b8bb512caec Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 28 Jul 2012 21:25:56 -0400 Subject: tune javascript refresh delays WebApp now shows changes with no delay. Comparing a running git-annex get and the webapp side-by-side, they both show each new transfer at the same time. --- Assistant/Threads/WebApp.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Assistant/Threads/WebApp.hs') diff --git a/Assistant/Threads/WebApp.hs b/Assistant/Threads/WebApp.hs index 430e6f50c..28d1a4882 100644 --- a/Assistant/Threads/WebApp.hs +++ b/Assistant/Threads/WebApp.hs @@ -95,14 +95,14 @@ instance Yesod WebApp where - Or, the home route is used if the whole page has to be refreshed to - update. - - - ms_delay is how long to delay between updates. - - ms_startdelay is how long to delay before updating the widget at the - - state. + - ms_delay is how long to delay between AJAX updates + - ms_startdelay is how long to delay before updating with AJAX at the start + - ms_refreshdelay is how long to delay between refreshes, when not using AJAX -} -autoUpdate :: Text -> Route WebApp -> Route WebApp -> Int -> Int -> Widget -autoUpdate updating gethtml home ms_delay ms_startdelay = do +autoUpdate :: Text -> Route WebApp -> Route WebApp -> Int -> Int -> Int -> Widget +autoUpdate updating gethtml home ms_delay ms_startdelay ms_refreshdelay = do {- Fallback refreshing is provided for non-javascript browsers. -} - let delayseconds = show $ ms_to_seconds ms_delay + let delayseconds = show $ ms_to_seconds ms_refreshdelay toWidgetHead $(hamletFile $ hamletTemplate "metarefresh") {- Use long polling to update the status display. -} @@ -130,7 +130,7 @@ statusDisplay = do nid <- liftIO $ notificationHandleToId <$> (newNotificationHandle =<< getNotificationBroadcaster webapp) - autoUpdate updating (StatusR nid) HomeR (3000 :: Int) (40 :: Int) + autoUpdate updating (StatusR nid) HomeR (10 :: Int) (10 :: Int) (3000 :: Int) getNotificationBroadcaster :: WebApp -> IO NotificationBroadcaster getNotificationBroadcaster webapp = notificationBroadcaster -- cgit v1.2.3