Skip to content

Commit fc21435

Browse files
fix: async send interval operation (#31)
1 parent fc9e350 commit fc21435

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/heartbeatClient.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Logger } from '@map-colonies/js-logger';
33
import { httpClientConfig } from './models/utils';
44

55
export class HeartbeatClient extends HttpClient {
6-
public intervalKey: number | null = null;
6+
public intervalKey: NodeJS.Timer | null = null;
77
public constructor(
88
protected readonly logger: Logger,
99
protected intervalMs: number,
@@ -27,11 +27,11 @@ export class HeartbeatClient extends HttpClient {
2727
this.intervalKey = null;
2828
}
2929
this.intervalKey = setInterval(
30-
() => {
31-
void this.send;
30+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
31+
async () => {
32+
await this.send(taskId);
3233
},
33-
this.intervalMs,
34-
taskId
34+
this.intervalMs
3535
);
3636
}
3737

@@ -48,7 +48,7 @@ export class HeartbeatClient extends HttpClient {
4848
}
4949
}
5050

51-
public async send(taskId: number): Promise<void> {
51+
public async send(taskId: string): Promise<void> {
5252
try {
5353
const heartbeatUrl = `/heartbeat/${taskId}`;
5454
await this.post(heartbeatUrl);

0 commit comments

Comments
 (0)