Make App Lock timeout configurable (#982)#1213
Merged
Charles-Gagnon merged 5 commits intoAzure:mainfrom Mar 17, 2026
Merged
Conversation
f21b8d1 to
9db206a
Compare
Add configurable AppLockTimeoutMs setting for the SQL trigger binding's application lock timeout. Previously hardcoded to 30 seconds, the timeout can now be configured via: - Sql_Trigger_AppLockTimeoutMs app setting - AppLockTimeoutMs property in host.json SqlOptions The default remains 30000ms (30 seconds) with a minimum of 1000ms (1 second). Changes: - Convert static AppLockStatements field to GetAppLockStatements(int) method - Add AppLockTimeoutMs property to SqlOptions with validation - Read config from app settings with SqlOptions fallback in SqlTableChangeMonitor, SqlTriggerListener, and SqlScalerProvider - Pass appLockTimeoutMs through ScaleMonitor/TargetScaler/MetricsProvider chain - Add telemetry for HasConfiguredAppLockTimeout and AppLockTimeoutMs - Add unit tests for new config and GetAppLockStatements method - Update documentation in BindingsOverview.md and TriggerBinding.md Closes Azure#982
9db206a to
91035ab
Compare
Charles-Gagnon
requested changes
Feb 19, 2026
…ation - Rename DefaultMinimumAppLockTimeoutMs to MinimumAppLockTimeoutMs (public const) to clarify it represents the minimum accepted value, not a default - Add min-value validation in SqlScalerProvider for app-settings value - Tighten validation in SqlTableChangeMonitor and SqlTriggerListener to check against MinimumAppLockTimeoutMs instead of just > 0 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Charles-Gagnon
approved these changes
Feb 24, 2026
There was a problem hiding this comment.
Pull request overview
This pull request adds configurable AppLockTimeoutMs setting for SQL trigger bindings to allow users to adjust the application lock timeout based on their specific server resource conditions. Previously hardcoded at 30 seconds, the timeout can now be configured via app settings (Sql_Trigger_AppLockTimeoutMs) or host.json (AppLockTimeoutMs in SqlOptions), with the same 30-second default and a validated minimum of 1 second.
Changes:
- Converted static
AppLockStatementsfield toGetAppLockStatements(int)method to accept dynamic timeout values - Added
AppLockTimeoutMsproperty toSqlOptionswith validation logic ensuring values are >= 1000ms - Updated SQL trigger components (SqlTableChangeMonitor, SqlTriggerListener, SqlScalerProvider, and metrics/scaling classes) to read configuration and pass the timeout through the call chain
- Added telemetry tracking for
HasConfiguredAppLockTimeoutandAppLockTimeoutMsmetrics - Updated documentation to explain the new configuration option
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Common/SqlOptions.cs | Added AppLockTimeoutMs property with validation (min 1000ms, default 30000ms) |
| src/TriggerBinding/SqlTriggerConstants.cs | Converted AppLockStatements static field to GetAppLockStatements(int) method |
| src/TriggerBinding/SqlTableChangeMonitor.cs | Added config reading and telemetry for app lock timeout |
| src/TriggerBinding/SqlTriggerListener.cs | Added config reading and app lock statements generation with configured timeout |
| src/TriggerBinding/SqlTriggerMetricsProvider.cs | Added appLockTimeoutMs parameter and field to store generated statements |
| src/TriggerBinding/SqlTriggerScaleMonitor.cs | Added appLockTimeoutMs parameter passed to metrics provider |
| src/TriggerBinding/SqlTriggerTargetScaler.cs | Added appLockTimeoutMs parameter passed to metrics provider |
| src/TriggerBinding/SqlScalerProvider.cs | Added config reading and validation for app lock timeout |
| src/Telemetry/Telemetry.cs | Added HasConfiguredAppLockTimeout property and AppLockTimeoutMs measure |
| test/Unit/SqlOptionsTests.cs | Added tests for AppLockTimeoutMs property validation and JSON serialization |
| test/Unit/TriggerBinding/SqlTriggerConstantsTests.cs | Added tests for GetAppLockStatements method |
| test/Unit/TriggerBinding/SqlTriggerScaleMonitorTests.cs | Updated test helpers to pass default app lock timeout |
| test/Integration/SqlTriggerBindingIntegrationTests.cs | Updated metrics provider instantiation with timeout parameter |
| docs/TriggerBinding.md | Updated documentation to mention configurable timeout |
| docs/BindingsOverview.md | Added section documenting Sql_Trigger_AppLockTimeoutMs setting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Charles-Gagnon
requested changes
Feb 24, 2026
VasuBhog
approved these changes
Mar 2, 2026
- SqlScalerProvider: Use nullable int for AppLockTimeoutMs config to distinguish 'not configured' from 'explicitly set to 0' - SqlTriggerListener: Add HasConfiguredAppLockTimeout property and AppLockTimeoutMs measure to StartListener telemetry event - SqlTriggerConstants: Merge duplicate XML summary doc comments on GetAppLockStatements method - SqlOptionsTests: Add test for negative AppLockTimeoutMs values Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
@Charles-Gagnon @VasuBhog thanks for reviewing. I've applied those changes |
Charles-Gagnon
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add configurable AppLockTimeoutMs setting for the SQL trigger binding's application lock timeout. Previously hardcoded to 30 seconds, the timeout can now be configured via:
The default remains 30000ms (30 seconds) with a minimum of 1000ms (1 second).
Changes:
Closes #982
Description
Please provide a detailed description. Be as descriptive as possible - include information about what is being changed,
why it's being changed, and any links to relevant issues. If this is closing an existing issue use one of the issue linking keywords to link the issue to this PR and have it automatically close when completed.
In addition, go through the checklist below and check each item as you validate it is either handled or not applicable to this change.
Code Changes
az_func.GlobalStatetable must be compatible with all prior versions of the extensionILoggerinstance to log relevant information, especially information useful for debugging or troubleshootingasyncandawaitfor all long-running operationsCancellationTokenDependencies
dotnet restore --force-evaluateto update the lock files and ensure that there are NO major versions updates in either src/packages.lock.json or Worker.Extensions.Sql/src/packages.lock.json. If there are, contact the dev team for instructions.Documentation