Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
fix: handle errors correctly
Browse files Browse the repository at this point in the history
Co-authored-by: KagChi <[email protected]>
Co-authored-by: Vann <[email protected]>
  • Loading branch information
3 people authored Feb 20, 2024
1 parent c12d2ec commit 2d99ee4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class ProcessBootstrapper {
* Bootstraps the child process with the provided options
*/
public async bootstrap(options: Readonly<BootstrapOptions> = {}): Promise<void> {
this.pgClient.on("error", e => this.logger.error(e, "Postgres emitted error"));
await this.pgClient.connect();
this.setupAmqp(); await this.stores.load();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ export class ProcessShardingStrategy implements IShardingStrategy {
setTimeout(async () => Result.fromAsync(() => worker.send(payload)), 2_000);
}
}
worker.on("error", error => this.logger.error({ error, shardIds: workerData.shardIds }, "process emitted error !"));
}).catch(error => setTimeout(() => {
this.logger.error(error, "Error when starting worker !");
const worker = this.#workerByShardId.get(workerData.shardIds[0])!;
Expand Down

0 comments on commit 2d99ee4

Please sign in to comment.