fix(publish-date-workflow-resolution): fix publish date#36635
fix(publish-date-workflow-resolution): fix publish date#36635syedATdot wants to merge 2 commits into
Conversation
Make the scheduled publishing workflow gate optionally scheme-selective and ensure failed workflow lookups still close the batch transaction.
|
Claude finished @fabrizzio-dotCMS's task in 2m 41s —— View job Code Review — PR #36635 (publish date workflow resolution)
I reviewed the workflow-resolution gate, the transaction refactor in New Issues
Notes (non-blocking)
• Branch |
|
Suggestion: read the config once per run, not per contentlet
// Publisher constructor
this.respectWorkflowResolution = Config.getBooleanProperty(RESPECT_WORKFLOW_RESOLUTION_PROPERTY, false);
this.configuredSchemes = configuredWorkflowSchemes(); // parsed once
Alternative: if you prefer all run-scoped config in one place, resolve them at the top of Please don't use a |
|
Test gap: mid-batch commit triggered by a failure
|
There was a problem hiding this comment.
Overall the approach is solid and the opt-in flag keeps historical behavior safe by default. Requesting changes so we address a scaling issue plus a couple of smaller items before merge.
Must address
-
Held content is re-scanned every run (scaling). A gated contentlet stays
live:false, so it keeps matchingPUBLISH_LUCENE_QUERYand is re-fetched (find), re-checked (findCurrentStep), and re-logged on every run — the job runs every minute, so the cost grows linearly with the backlog of unresolved content and never clears on its own. Push the workflow predicate into the publish query so held items are excluded at the index level (+wfstep:(<resolvedStepIds>), resolved at query-build time sinceresolvedis a step-definition property, not an indexed per-content field). KeepworkflowAllowsScheduledPublish(...)as the authoritative final gate for index-staleness and the scoped/no-step cases. Details in a separate comment below. -
Log level for held items.
workflowAllowsScheduledPublish(...)logs atWARNper held item per run. A held item is expected steady state, not an anomaly — this becomes per-item-per-minute log spam. Lower toDEBUG(matches the existing "already auto-published and manually unpublished" skip).
Minor
-
Read the config once per run, not per contentlet.
Config.getBooleanProperty(...)/configuredWorkflowSchemes()are evaluated inside the per-contentletprocess(...)path. Resolve them once when thePublisheris built and reuse. (See inline comment.) -
Test gap: mid-batch commit triggered by a failure. The transaction-boundary change now commits on visited count including failed/missing contentlets — please add a test that exercises a commit boundary reached via a failure, not only via successful processing. (See inline comment.)
| @VisibleForTesting | ||
| static boolean workflowAllowsScheduledPublish(final Contentlet contentlet, | ||
| final WorkflowAPI workflowAPI) throws DotDataException, DotSecurityException { | ||
| if (!Config.getBooleanProperty(RESPECT_WORKFLOW_RESOLUTION_PROPERTY, false)) { |
There was a problem hiding this comment.
No need to re-read this value over and over again; do it once at the beginning, at the constructor level
|
On the "records pile up and come back every run" concern — agreed, and I think the right fix is to push the workflow predicate into the search query. The candidate set is fetched here via an Elasticsearch query: // PublishDateUpdater.java:449
final List<String> allInodes = contentletAPI.searchIndex(luceneQuery, 0, 0, null,
systemUser, false).stream().map(ContentletSearch::getInode).collect(Collectors.toList());Since a held contentlet stays To be precise: filtering in the query does not stop the content from accumulating (that's inherent to the feature — we intentionally hold it until the workflow resolves). What it fixes is that the accumulation stops being expensive to skip repeatedly. Per-run cost goes from
Feasibility: the workflow fields are indexed — This should go into the publish query only — built around Suggestion — keep both, they solve different problems:
Net: the query filter is the scaling optimization; the Java gate stays as the correctness safety net. |
Fixes #36634
Imported from external fork contribution by @riccardoruocco (
riccardoruocco/core, branchfix/publish-date-workflow-resolution) so CI can run on it..