On Thu, Nov 26, 2015 at 06:41:01PM +0100, Klaus Aehlig wrote:
> Given that on updates it has to be fully computed anyway, do not
> accumulate thunks during the computation.
> 
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/Locking/Allocation.hs | 18 ++++++++++--------
>  src/Ganeti/Locking/Waiting.hs    | 25 +++++++++++++------------
>  2 files changed, 23 insertions(+), 20 deletions(-)

Unfortunately this patch introduced lines longer than 80 chars; so I'd
like to include the following interdiff.

diff --git a/src/Ganeti/Locking/Waiting.hs b/src/Ganeti/Locking/Waiting.hs
index bdac2ec..7795b68 100644
--- a/src/Ganeti/Locking/Waiting.hs
+++ b/src/Ganeti/Locking/Waiting.hs
@@ -163,12 +163,14 @@ revisitRequests notify todo state =
   let getRequests (pending, reqs) owner =
         (M.delete owner pending
         , fromMaybe S.empty (M.lookup owner pending) `S.union` reqs)
-      (pending', requests) = S.foldl' getRequests (lwPending state, S.empty) 
todo
+      (pending', requests) = S.foldl' getRequests (lwPending state, S.empty)
+                               todo
       revisitedOwners = S.map (\(_, o, _) -> o) requests
       pendingOwners' = S.foldl' (flip M.delete) (lwPendingOwners state)
                                revisitedOwners
       state' = state { lwPending = pending', lwPendingOwners = pendingOwners' }
-      (!state'', !notify') = S.foldl' tryFulfillRequest (state', notify) 
requests
+      (!state'', !notify') = S.foldl' tryFulfillRequest (state', notify)
+                               requests
       done = notify `S.union` todo
       !newTodo = notify' S.\\ done
   in if S.null todo


-- 
Klaus Aehlig
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores

Reply via email to