Skip to content

Commit d77a6e4

Browse files
committed
Not allowing non-integer values
1 parent a4b29c5 commit d77a6e4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

bolt-connection/src/connection/connection-channel.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,10 @@ export default class ChannelConnection extends Connection {
207207
receiveTimeoutRaw !== undefined
208208
) {
209209
const receiveTimeoutInSeconds = toNumber(receiveTimeoutRaw)
210-
if (receiveTimeoutInSeconds > 0) {
210+
if (
211+
Number.isInteger(receiveTimeoutInSeconds) &&
212+
receiveTimeoutInSeconds > 0
213+
) {
211214
this._ch.setupReceiveTimeout(receiveTimeoutInSeconds * 1000)
212215
} else {
213216
this._log.info(

bolt-connection/test/connection/connection-channel.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,14 @@ describe('ChannelConnection', () => {
8686
)
8787

8888
it.each([
89+
[{ hints: { 'connection.recv_timeout_seconds': -1.5 } }],
8990
[{ hints: { 'connection.recv_timeout_seconds': -1 } }],
9091
[{ hints: { 'connection.recv_timeout_seconds': -1n } }],
9192
[{ hints: { 'connection.recv_timeout_seconds': int(-1) } }],
9293
[{ hints: { 'connection.recv_timeout_seconds': 0 } }],
9394
[{ hints: { 'connection.recv_timeout_seconds': 0n } }],
94-
[{ hints: { 'connection.recv_timeout_seconds': int(0) } }]
95+
[{ hints: { 'connection.recv_timeout_seconds': int(0) } }],
96+
[{ hints: { 'connection.recv_timeout_seconds': 12.1 } }]
9597
])(
9698
'should call log an info when onComplete metadata is %o',
9799
async metadata => {

0 commit comments

Comments
 (0)