You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3cf0b63
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Page the "Register content move redirects" job so it survives large tables (6.x backport of #188) (#193)
* Page the move-redirects job so it survives large tables
The "Register content move redirects" job loaded the entire
NotFoundHandler.ContentUrlHistory table in one unbounded query
(GetAllMoved -> .ToList()). On large tables that SELECT exceeds the
SqlClient command timeout, and SqlDataExecutor.ExecuteQuery swallowed the
exception then returned ds.Tables[0] on an empty DataSet, surfacing a
misleading "Cannot find table 0" instead of the real timeout.
- SqlDataExecutor: apply a configurable CommandTimeout and rethrow query
failures instead of masking them as "Cannot find table 0".
- NotFoundHandlerOptions.CommandTimeout (default 30s).
- IContentUrlHistoryLoader/SqlContentUrlHistoryRepository: add a paged
GetAllMoved(skip, take) using OFFSET/FETCH over the moved keys, and make
the parameterless overload stream pages so the unbounded query is gone.
- RegisterMovedContentRedirectsJob: process the table page-by-page,
tunable via OptimizelyNotFoundHandlerOptions.MovedContentBatchSize
(default 1000).
- Tests for repository paging and job batching; README updated.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Address review: clamp batch size, keep interface source-compatible, changelog
Review feedback on PR #188 (thanks @ivanmarkovic1402):
- RegisterMovedContentRedirectsJob: clamp MovedContentBatchSize to >= 1.
A misconfigured 0/negative would page with "FETCH NEXT 0 ROWS ONLY"
(invalid SQL) and, now that ExecuteQuery rethrows, fail the whole job.
- IContentUrlHistoryLoader.GetAllMoved(skip, take) is now a default
interface implementation (pages in-memory over GetAllMoved()), so the
addition no longer breaks third-party implementers. Data-backed stores
(SqlContentUrlHistoryRepository) still override it with the OFFSET/FETCH
query.
- CHANGELOG: document the new options (CommandTimeout, MovedContentBatchSize),
the paged GetAllMoved, and the ExecuteQuery rethrow behavior change.
- Tests: guard test for the batch-size clamp and an exact-multiple-of-batch
case (one trailing empty fetch, then stop).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Harden paged query and command timeout against bad inputs
- SqlContentUrlHistoryRepository.GetAllMoved(skip, take): short-circuit to
empty when take <= 0 (FETCH NEXT 0/negative ROWS is invalid SQL) and clamp
a negative skip, so a direct caller can't push invalid SQL to the database.
- SqlDataExecutor: clamp a negative CommandTimeout to 0; SqlCommand.CommandTimeout
otherwise throws and would break every query. Documented 0 = no timeout.
- Tests: cover the non-positive take guard; drop an xUnit2013 warning.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Update CHANGELOG for version 6.1.0 release
Documented the addition of new options for handling content moves and command timeouts in version 6.1.0.
---------
Co-authored-by: Kenny Gutierrez <Kenny.Gutierrez@centurycommunities.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: valdis iljuconoks <valdis.iljuconoks@outlook.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,17 @@
2
2
3
3
All notable changes to this project will be documented in this file.
4
4
5
+
## [6.1.0]
6
+
7
+
### Added
8
+
9
+
-`OptimizelyNotFoundHandlerOptions.MovedContentBatchSize` (default 1000) and `NotFoundHandlerOptions.CommandTimeout` so the "Register content move redirects" job pages through large `NotFoundHandler.ContentUrlHistory` tables instead of loading every row in one unbounded query that exceeded the command timeout.
10
+
-`IContentUrlHistoryLoader.GetAllMoved(int skip, int take)` for paged access to moved content. Ships as a default interface implementation (pages in-memory over `GetAllMoved()`), so existing implementers keep compiling.
11
+
12
+
### Changed
13
+
14
+
-`SqlDataExecutor.ExecuteQuery` now propagates SQL exceptions (e.g. command timeouts) instead of swallowing them and returning an empty result, which previously surfaced as a misleading "Cannot find table 0" error.
Copy file name to clipboardExpand all lines: README.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,6 +152,8 @@ If the `bufferSize` is set to `0`, the `threshold` value will be ignored, and ev
152
152
153
153
**LogWithHostname**: Set to `true` to include hostname in the log. Useful in a multisite environment with several hostnames/domains. Default is `false`
154
154
155
+
**CommandTimeout**: Command timeout, in seconds, applied to SQL queries issued by the NotFound handler. Raise it past the SqlClient default of 30 if you have very large NotFound handler tables. Default is 30
156
+
155
157
**ActiveStatusCodes**: A integerlist with the status codes that NotFoundHandler will be active on. (Ex. ```options.ActiveStatusCodes = new int[] { StatusCodes.Status404NotFound, StatusCodes.Status410Gone };```)
156
158
157
159
### Specifying ignored resources
@@ -320,7 +322,13 @@ An Optimizely scheduled job was added - <code>[Geta NotFoundHandler] Suggestions
320
322
321
323
Additionally, there are two optimizely scheduled jobs responsible for:
322
324
-*[Geta NotFoundHandler] Index content URLs* - as mentioned before, this job indexes URLs of content. Usually, it is required to run this job only once. All new content is automatically indexed. But if for some reason content publish events are not firing when creating new content (for example, during the import), then you should set this job to run frequently.
323
-
-*[Geta NotFoundHandler] Register content move redirects* - this job creates redirects based on registered moved content. Normally, this job is not required at all, but there might be situations when content move is registered but redirect creation is not completed. This could happen during deployments. In this case, you can manually run this job or schedule it to run time to time to fix such issues.
325
+
-*[Geta NotFoundHandler] Register content move redirects* - this job creates redirects based on registered moved content. Normally, this job is not required at all, but there might be situations when content move is registered but redirect creation is not completed. This could happen during deployments. In this case, you can manually run this job or schedule it to run time to time to fix such issues. The job processes the `NotFoundHandler.ContentUrlHistory` table page-by-page so it scales to large tables. You can tune the page size via `MovedContentBatchSize` (default 1000):
0 commit comments