Skip to content

Commit

Permalink
activate?
Browse files Browse the repository at this point in the history
  • Loading branch information
TBonnin committed Dec 12, 2024
1 parent e0d8379 commit 6d93a08
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions packages/fleet/lib/supervisor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,25 +116,22 @@ export class Supervisor {
}

public async tick(): Promise<Result<void>> {
const tickSpan = tracer.startSpan('fleet.supervisor.tick');
return tracer.scope().activate(tickSpan, async () => {
try {
this.tickCancelled = false;

const plan = await this.plan();
if (plan.isOk()) {
await this.executePlan(plan.value);
return Ok(undefined);
} else {
return Err(plan.error);
}
} catch (err) {
tickSpan.setTag('error', err);
return Err(new FleetError('supervisor_tick_failed', { cause: err }));
} finally {
tickSpan.finish();
const span = tracer.startSpan('fleet.supervisor.tick');
try {
this.tickCancelled = false;
const plan = await this.plan();
if (plan.isOk()) {
await this.executePlan(plan.value);
return Ok(undefined);
} else {
return Err(plan.error);
}
});
} catch (err) {
span.setTag('error', err);
return Err(new FleetError('supervisor_tick_failed', { cause: err }));
} finally {
span.finish();
}
}

private async loop(): Promise<void> {
Expand Down

0 comments on commit 6d93a08

Please sign in to comment.