Skip to content

Remote dev implement full resync

Hunar Khanna requested to merge remote_dev_implement_full_resync into remote_dev

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 the remoteDevWorker interface 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 log package with zap.Logger in k8s_informer.go
  • Added support for workspace_full_sync message type and renamed existing workspace_updates to workspace_partial_sync
  • Refactored the logic in module.Run logic to fix a bug and introduced stoppableTask. The initial goal was to fix a bug in module.go below

Screenshot_2023-03-31_at_6.35.52_PM

Bug description

  • If the cfg channel is closed any time after L43 is in execution, the program will hang because the deferred cancel will never get to execute because of the wg.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 separate StoppableTask abstraction since it seemed like what the intent was anyway
  • StoppableTask is also re-used in k8s_informer
Edited by Hunar Khanna

Merge request reports

Loading