Stop scanner interval before starting a new one

This ensures there are no orphaned intervals running.
This commit is contained in:
Juan Cruz Viotti 2016-03-08 16:19:48 -04:00
parent 728524f6e3
commit fdcc5d6b71

View File

@ -133,6 +133,10 @@ driveScanner.service('DriveScannerService', function($q, $interval, $timeout) {
});
};
// Make sure any pending interval is cancelled
// to avoid potential memory leaks.
self.stop();
// Call fn after in the next process tick
// to be able to capture the first run
// in unit tests.