Skip to content

Commit

Permalink
recheck vm every 30 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
howardchung committed Mar 23, 2024
1 parent 3affa88 commit d8dad18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 3 additions & 2 deletions server/vm/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,9 @@ export abstract class VMManager {
// Fetch data on first attempt
// Try again only every once in a while to reduce load on API
const shouldFetchVM =
retryCount === this.minRetries + 1 || retryCount % 20 === 0;
if (!vm && shouldFetchVM) {
retryCount === this.minRetries + 1 || retryCount % 30 === 0;
// Refetch the VM every once in a while even if cached to check if it should be deleted
if (shouldFetchVM) {
try {
vm = await this.getVM(vmid);
} catch (e: any) {
Expand Down
3 changes: 0 additions & 3 deletions server/vm/hetzner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ export class Hetzner extends VMManager {
response?.headers['ratelimit-remaining'],
);
redis?.set('hetznerApiRemaining', response?.headers['ratelimit-remaining']);
if (response.data.server.private_net?.length > 1) {
console.log('[WARNING] %s has more than one private network', id);
}
const server = this.mapServerObject(response.data.server);
return server;
};
Expand Down

0 comments on commit d8dad18

Please sign in to comment.