Skip to content

Commit

Permalink
update cleanup logic
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Jan 27, 2025
1 parent 3c911db commit 5a46aad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,7 @@ async function getStats() {
const vBrowserFails = await getRedisCountDay('vBrowserFails');
const vBrowserStagingFails = await getRedisCountDay('vBrowserStagingFails');
const vBrowserReimages = await getRedisCountDay('vBrowserReimage');
const vBrowserCleanups = await getRedisCountDay('vBrowserCleanup');
const vBrowserStopTimeout = await getRedisCountDay(
'vBrowserTerminateTimeout',
);
Expand Down Expand Up @@ -1009,6 +1010,7 @@ async function getStats() {
vBrowserFails,
vBrowserStagingFails,
vBrowserReimages,
vBrowserCleanups,
vBrowserStopManual,
vBrowserStopEmpty,
vBrowserStopTimeout,
Expand Down
6 changes: 4 additions & 2 deletions server/vm/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export abstract class VMManager {
for (let i = 0; i < allVMs.length; i++) {
const server = allVMs[i];
if (!inUse.has(server.id)) {
// TODO log how many cleanups we do
redisCount('vBrowserCleanup');
console.log('[CLEANUP]', this.getPoolName(), server.id);
try {
await this.resetVM(server.id);
Expand Down Expand Up @@ -476,7 +476,9 @@ export abstract class VMManager {
// VM didn't come up. Try reimaging
await this.reimageVM(vmid);
redisCount('vBrowserReimage');
await this.resetVM(vmid);
// Don't reset here since reboot will fail while VM is reimaging
// Cleanup will process it eventually
// await this.resetVM(vmid);
}
if (retryCount >= 180) {
throw new Error('too many attempts on vm ' + vmid);
Expand Down

0 comments on commit 5a46aad

Please sign in to comment.