Remote dev implement full resync
What does this MR do
- Implements full sync of workspace as covered here
- Added spec to verify the implemented logic in
module_test.go - Since implementing full_sync requires stopping and starting workers,
Stop()has been added to theremoteDevWorkerinterface to allow an outgoing worker to cleanup as its shutting down. More concretely, it is need to stop the informer for the outgoing worker. - Replace
logpackage withzap.Loggerink8s_informer.go - Added support for
workspace_full_syncmessage type and renamed existingworkspace_updatestoworkspace_partial_sync - Refactored the logic in
module.Runlogic to fix a bug and introducedstoppableTask. The initial goal was to fix a bug inmodule.gobelow
Bug description
- If the
cfgchannel is closed any time after L43 is in execution, the program will hang because the deferred cancel will never get to execute because of thewg.Wait()at L59 - While I'm not sure if this can occur in production, it can and did occur in my local environment as I was debugging failing test cases
- The initial fix was straightforward i.e just put a cancel call at L58 before the
wg.Wait(), however I refactored it into a separateStoppableTaskabstraction since it seemed like what the intent was anyway -
StoppableTaskis also re-used ink8s_informer
Edited by Hunar Khanna
