Skip to content

maxConnectionRetryCount: 0 is coerced to 1 #64

Description

@yeongseon

Summary

Passing maxConnectionRetryCount: 0 does not disable retries. The constructor coerces 0 to 1, so the client always retries at least once.

Reproduction

cd /data/GitHub/node-cubrid
node - <<'NODE'
const CUBRID = require('./');
const client = new CUBRID.createConnection({ hosts:['localhost'], maxConnectionRetryCount: 0 });
console.log(client.maxConnectionRetryCount);
NODE

Actual

The script prints 1.

Expected

The script should print 0, so callers can explicitly disable retry loops.

Likely cause

src/CUBRIDConnection.js initializes the field with:

this.maxConnectionRetryCount = maxConnectionRetryCount || 1;

That treats 0 as missing input.

Suggested fix

Use nullish handling instead of ||, for example:

this.maxConnectionRetryCount = maxConnectionRetryCount ?? 1;

or an equivalent explicit undefined check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions