tedious icon indicating copy to clipboard operation
tedious copied to clipboard

feat: Add LOCK_TIMEOUT connection setting

Open etinquis opened this issue 3 months ago • 1 comments

This PR adds a new lockTimeout connection setting, which sets LOCK_TIMEOUT (https://learn.microsoft.com/en-us/sql/t-sql/statements/set-lock-timeout-transact-sql) along with the existing connection preamble statements.

Before submitting a PR :

  1. [x] Ensure your fork is created from master branch of the repository.
  2. [x] Run npm install in the root folder.
  3. [x] After bug fix/code change, ensure all the existing tests and new tests (if any) pass (npm run-script test-all). During development, to run individual test use node_modules/nodeunit test/<test_file.js> -t <test_name>.
  # 1 (unrelated?) test failure; I'm running against an ephemeral docker db, if it's relevant: docker run --rm -it -e ACCEPT_EULA=Y -e MSSQL_PID=Express -e 'MSSQL_SA_PASSWORD=yourStrong(!)Password' -p 127.0.0.1:17000:1433/tcp mcr.microsoft.com/mssql/server:2022-CU19-ubuntu-22.04
  824 passing (35s)
  11 pending
  1 failing

  1) MessageIO
       #startTls
         handles errors that happen during TLS negotiation:

      AssertionError: expected 'ERR_SSL_SSL/TLS_ALERT_HANDSHAKE_FAILU…' to equal 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE'
      + expected - actual

      -ERR_SSL_SSL/TLS_ALERT_HANDSHAKE_FAILURE
      +ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE
      
      at /home/etinquis/Projects/tedious/test/unit/message-io-test.ts:566:20
      at processTicksAndRejections (node:internal/process/task_queues:105:5)
      at async Promise.all (index 0)
      at Context.<anonymous> (test/unit/message-io-test.ts:551:7)
  1. [x] Build the driver (npm run build).
> [email protected] build
> rimraf lib && babel src --out-dir lib --extensions .js,.ts && npm run build:types

Successfully compiled 100 files with Babel (1642ms).

> [email protected] build:types
> tsc --project tsconfig.build-types.json
  1. [x] Run eslint and flow typechecker (npm run lint).
> [email protected] lint
> eslint src test --ext .js,.ts && tsc
  1. [x] Run commitlint (node_modules/.bin/commitlint --from origin/master --to HEAD). Refer commit conventions and commit rules.
# Had to install commitlint, still fails
⧗   input: feat: Add LOCK_TIMEOUT connection setting
✖   Please add rules to your `commitlint.config.js`
    - Getting started guide: https://commitlint.js.org/guides/getting-started
    - Example config: https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-conventional/src/index.ts [empty-rules]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

Thank you for Contributing!

etinquis avatar Oct 11 '25 02:10 etinquis

Codecov Report

:x: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 78.82%. Comparing base (77800dd) to head (fa6d281).

Files with missing lines Patch % Lines
src/connection.ts 66.66% 1 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1694      +/-   ##
==========================================
- Coverage   78.84%   78.82%   -0.02%     
==========================================
  Files          90       90              
  Lines        4887     4893       +6     
  Branches      920      923       +3     
==========================================
+ Hits         3853     3857       +4     
- Misses        736      737       +1     
- Partials      298      299       +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Nov 11 '25 13:11 codecov[bot]