Skip to content

Commit efff4c0

Browse files
committed
dedupe HEARTBEAT_INTERVAL between src and test
1 parent f1eb74d commit efff4c0

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/tracing/src/idletransaction.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { SpanStatus } from './spanstatus';
77
import { Transaction } from './transaction';
88

99
export const DEFAULT_IDLE_TIMEOUT = 1000;
10+
export const HEARTBEAT_INTERVAL = 5000;
1011

1112
/**
1213
* @inheritDoc
@@ -265,7 +266,7 @@ export class IdleTransaction extends Transaction {
265266
logger.log(`pinging Heartbeat -> current counter: ${this._heartbeatCounter}`);
266267
setTimeout(() => {
267268
this._beat();
268-
}, 5000);
269+
}, HEARTBEAT_INTERVAL);
269270
}
270271
}
271272

packages/tracing/test/idletransaction.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import { BrowserClient } from '@sentry/browser';
22
import { Hub } from '@sentry/hub';
33

4-
import { DEFAULT_IDLE_TIMEOUT, IdleTransaction, IdleTransactionSpanRecorder } from '../src/idletransaction';
4+
import {
5+
DEFAULT_IDLE_TIMEOUT,
6+
HEARTBEAT_INTERVAL,
7+
IdleTransaction,
8+
IdleTransactionSpanRecorder,
9+
} from '../src/idletransaction';
510
import { Span } from '../src/span';
611
import { SpanStatus } from '../src/spanstatus';
712

@@ -177,7 +182,6 @@ describe('IdleTransaction', () => {
177182

178183
describe('heartbeat', () => {
179184
it('does not mark transaction as `DeadlineExceeded` if idle timeout has not been reached', () => {
180-
const HEARTBEAT_INTERVAL = 5000;
181185
// 20s to exceed 3 heartbeats
182186
const transaction = new IdleTransaction({ name: 'foo' }, hub, 20000);
183187
const mockFinish = jest.spyOn(transaction, 'finish');

0 commit comments

Comments
 (0)