-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed the router reload timing controls
Mostly so that a router reload doesn't hold a lock of the router object for the duration of the reload. But added other controls too... need to elaborate! Commit() // When this is called: // - Acquire lock // - Set $needCommit state to Now // - Release lock // - Call bottom-half callback commitWorker() // Bottom half callback: // - Acquire lock // - Check $commitRunning state // - If running: // - We are done... we will catch the new work when the job finishes // - Release lock // - Return // - If not running, check times: // - If one of: // * time.Now() - $lastReloadStart < $minReloadGap -- Overall start to start reload time // * time.Now() - $lastReloadEnd < $minReloadFreq -- Gap between last reload end and next // * time.Now() - $needCommit < $reloadCoalesceDur -- Gather a few events before a reload // Then: // - Set $needCommit and trigger callback for remaining time above // - Release lock // - Return // - Else, we can reload, so: // - Set $commitRunning // - Set $lastReloadStart // - Clear $needCommit // - Release lock // - Call the reload function and wait // - Acquire lock // - Clear $commitRunning // - Set $lastReloadEnd // - Release lock // - Call the callback function again to catch trailing work // - Return
- Loading branch information
Showing
3 changed files
with
189 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters