Skip to content

fix: add ELO calculation retry and dedicated server state recovery#142

Open
Flegma wants to merge 2 commits intomainfrom
audit/377-elo-retry
Open

fix: add ELO calculation retry and dedicated server state recovery#142
Flegma wants to merge 2 commits intomainfrom
audit/377-elo-retry

Conversation

@Flegma
Copy link
Copy Markdown
Contributor

@Flegma Flegma commented Apr 8, 2026

Summary

  • Add try/catch with logging around ELO calculation postgres query, re-throwing for BullMQ retry
  • Configure ELO calculation queue with exponential backoff retry (3 attempts, 5s initial delay)
  • Recover dedicated server state when pod readiness check fails (clean up deployment instead of leaving server in disconnected state)

Addresses 5stackgg/5stack-panel#377

Test plan

  • Verify ELO calculation retries on transient postgres failures
  • Verify dedicated server cleanup occurs when pod fails to become ready
  • Confirm normal ELO calculation and server setup paths still work

`[${serverId}] error waiting for pod to be ready, recovering server state`,
error,
);
await this.removeDedicatedServer(serverId).catch((removeError) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this. im not sure why we are trying to remove here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the removeDedicatedServer call from the catch block.

@@ -1,23 +1,34 @@
import { Job } from "bullmq";
import { WorkerHost } from "@nestjs/bullmq";
import { Logger } from "@nestjs/common";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have our own logger handler for this. look at other loggers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched from new Logger(EloCalculation.name) to constructor-injected private readonly logger: Logger to match the project's standard pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants