rds-database-running-scheduler 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +3 -3
- package/API.md +4 -0
- package/assets/funcs/running-schedule.lambda/index.js +45 -11
- package/assets/funcs/running-schedule.lambda/index.js.map +1 -1
- package/lib/rds-database-running-schedule-stack.js +1 -1
- package/lib/rds-database-running-scheduler.js +1 -1
- package/package.json +4 -4
package/.jsii
CHANGED
|
@@ -8448,7 +8448,7 @@
|
|
|
8448
8448
|
"stability": "stable"
|
|
8449
8449
|
},
|
|
8450
8450
|
"homepage": "https://github.com/gammarers-aws-cdk-constructs/rds-database-running-scheduler.git",
|
|
8451
|
-
"jsiiVersion": "6.0.
|
|
8451
|
+
"jsiiVersion": "6.0.25 (build a771806)",
|
|
8452
8452
|
"keywords": [
|
|
8453
8453
|
"aurora",
|
|
8454
8454
|
"aws",
|
|
@@ -9202,6 +9202,6 @@
|
|
|
9202
9202
|
"symbolId": "src/rds-database-running-scheduler:WaitTimeoutNotification"
|
|
9203
9203
|
}
|
|
9204
9204
|
},
|
|
9205
|
-
"version": "0.7.
|
|
9206
|
-
"fingerprint": "
|
|
9205
|
+
"version": "0.7.2",
|
|
9206
|
+
"fingerprint": "YsIoiRfq2yRV855Qc/f60EcebUBRg+OMn7ynMSHCu98="
|
|
9207
9207
|
}
|
package/API.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
### RDSDatabaseRunningScheduler <a name="RDSDatabaseRunningScheduler" id="rds-database-running-scheduler.RDSDatabaseRunningScheduler"></a>
|
|
6
6
|
|
|
7
|
+
- *Implements:* constructs.IConstruct, constructs.IDependable
|
|
8
|
+
|
|
7
9
|
CDK construct that provisions a durable Lambda workflow and EventBridge schedules to start/stop tagged RDS databases and clusters.
|
|
8
10
|
|
|
9
11
|
The Lambda lists the regions enabled for the account and searches each one
|
|
@@ -184,6 +186,8 @@ Undefined unless `failureDetection.enabled` is `true`.
|
|
|
184
186
|
|
|
185
187
|
### RDSDatabaseRunningScheduleStack <a name="RDSDatabaseRunningScheduleStack" id="rds-database-running-scheduler.RDSDatabaseRunningScheduleStack"></a>
|
|
186
188
|
|
|
189
|
+
- *Implements:* constructs.IConstruct, constructs.IDependable, aws-cdk-lib.ITaggable
|
|
190
|
+
|
|
187
191
|
CDK stack that provisions scheduled start/stop control for tagged RDS resources in the enabled regions of the deployment account, or only in `targetRegions`.
|
|
188
192
|
|
|
189
193
|
Delegates resource discovery, cluster-priority deduplication, start/stop
|
|
@@ -21577,6 +21577,9 @@ var DurableLogLevel;
|
|
|
21577
21577
|
})(DurableLogLevel || (DurableLogLevel = {}));
|
|
21578
21578
|
var StepSemantics;
|
|
21579
21579
|
(function(StepSemantics2) {
|
|
21580
|
+
StepSemantics2["AtMostOnce"] = "AT_MOST_ONCE_PER_RETRY";
|
|
21581
|
+
StepSemantics2["AtLeastOnce"] = "AT_LEAST_ONCE_PER_RETRY";
|
|
21582
|
+
StepSemantics2["AtLeastOnceAsync"] = "AT_LEAST_ONCE_ASYNC";
|
|
21580
21583
|
StepSemantics2["AtMostOncePerRetry"] = "AT_MOST_ONCE_PER_RETRY";
|
|
21581
21584
|
StepSemantics2["AtLeastOncePerRetry"] = "AT_LEAST_ONCE_PER_RETRY";
|
|
21582
21585
|
})(StepSemantics || (StepSemantics = {}));
|
|
@@ -22391,7 +22394,7 @@ var getStepData = (stepData, stepId) => {
|
|
|
22391
22394
|
const hashedId = hashId(stepId);
|
|
22392
22395
|
return stepData[hashedId];
|
|
22393
22396
|
};
|
|
22394
|
-
var createStepHandler = (context, checkpoint, _parentContext, createStepId, logger, parentId, getDefaultSerdes, plugin = {}, pluginOperationName, signal = new AbortController().signal) => {
|
|
22397
|
+
var createStepHandler = (context, checkpoint, _parentContext, createStepId, logger, parentId, getDefaultSerdes, plugin = {}, pluginOperationName, signal = new AbortController().signal, defaultSemantics = StepSemantics.AtLeastOnce) => {
|
|
22395
22398
|
return (nameOrFn, fnOrOptions, maybeOptions) => {
|
|
22396
22399
|
let name;
|
|
22397
22400
|
let fn;
|
|
@@ -22405,7 +22408,7 @@ var createStepHandler = (context, checkpoint, _parentContext, createStepId, logg
|
|
|
22405
22408
|
options = fnOrOptions;
|
|
22406
22409
|
}
|
|
22407
22410
|
const stepId = createStepId();
|
|
22408
|
-
const semantics = options?.semantics ||
|
|
22411
|
+
const semantics = options?.semantics || defaultSemantics;
|
|
22409
22412
|
const subType = options?.subType || OperationSubType.STEP;
|
|
22410
22413
|
const serdes = options?.serdes || (getDefaultSerdes ? getDefaultSerdes() : defaultSerdes);
|
|
22411
22414
|
const phase1Promise = (async () => {
|
|
@@ -22455,7 +22458,7 @@ var createStepHandler = (context, checkpoint, _parentContext, createStepId, logg
|
|
|
22455
22458
|
return await executeStepLogic();
|
|
22456
22459
|
})();
|
|
22457
22460
|
}
|
|
22458
|
-
if (stepData?.Status === OperationStatus.STARTED && semantics === StepSemantics.
|
|
22461
|
+
if (stepData?.Status === OperationStatus.STARTED && semantics === StepSemantics.AtMostOnce) {
|
|
22459
22462
|
const error = new StepInterruptedError(stepId, name);
|
|
22460
22463
|
const currentAttempt = (stepData.StepDetails?.Attempt || 0) + 1;
|
|
22461
22464
|
const retryDecision = options?.retryStrategy?.(error, currentAttempt) ?? retryPresets.default(error, currentAttempt);
|
|
@@ -22512,7 +22515,7 @@ var createStepHandler = (context, checkpoint, _parentContext, createStepId, logg
|
|
|
22512
22515
|
async function executeStepLogic() {
|
|
22513
22516
|
stepData = context.getStepData(stepId);
|
|
22514
22517
|
if (stepData?.Status !== OperationStatus.STARTED) {
|
|
22515
|
-
if (semantics === StepSemantics.
|
|
22518
|
+
if (semantics === StepSemantics.AtMostOnce) {
|
|
22516
22519
|
await checkpoint.checkpoint(stepId, {
|
|
22517
22520
|
Id: stepId,
|
|
22518
22521
|
ParentId: parentId,
|
|
@@ -22577,7 +22580,8 @@ var createStepHandler = (context, checkpoint, _parentContext, createStepId, logg
|
|
|
22577
22580
|
const wrapOperationAttemptFn = plugin.wrapOperationAttemptFn;
|
|
22578
22581
|
const result = await runWithContext(stepId, parentId, wrapOperationAttemptFn ? () => wrapOperationAttemptFn.call(plugin, attemptInfo, stepFn) : stepFn, currentAttempt, DurableExecutionMode.ExecutionMode, name);
|
|
22579
22582
|
const serializedResult = await safeSerialize(serdes, result, stepId, name, context.terminationManager, context.durableExecutionArn);
|
|
22580
|
-
|
|
22583
|
+
const isAsync = semantics === StepSemantics.AtLeastOnceAsync;
|
|
22584
|
+
const succeedUpdate = {
|
|
22581
22585
|
Id: stepId,
|
|
22582
22586
|
ParentId: parentId,
|
|
22583
22587
|
Action: OperationAction.SUCCEED,
|
|
@@ -22585,11 +22589,23 @@ var createStepHandler = (context, checkpoint, _parentContext, createStepId, logg
|
|
|
22585
22589
|
Type: OperationType.STEP,
|
|
22586
22590
|
Payload: serializedResult,
|
|
22587
22591
|
Name: name
|
|
22588
|
-
}
|
|
22592
|
+
};
|
|
22593
|
+
const succeedCheckpoint = isAsync ? checkpoint.checkpoint(stepId, succeedUpdate, { awaited: false }) : checkpoint.checkpoint(stepId, succeedUpdate);
|
|
22594
|
+
if (isAsync) {
|
|
22595
|
+
void succeedCheckpoint;
|
|
22596
|
+
} else {
|
|
22597
|
+
await succeedCheckpoint;
|
|
22598
|
+
}
|
|
22589
22599
|
stepData = context.getStepData(stepId);
|
|
22590
22600
|
const attemptEndInfo = toAttemptEndInfo(stepData, AttemptEndInfoOutcome.SUCCEEDED, {
|
|
22591
22601
|
attempt: currentAttempt
|
|
22592
22602
|
});
|
|
22603
|
+
if (isAsync) {
|
|
22604
|
+
attemptEndInfo.status = PluginOperationStatus.SUCCEEDED;
|
|
22605
|
+
attemptEndInfo.result = serializedResult;
|
|
22606
|
+
attemptEndInfo.startTimestamp ??= attemptInfo.startTimestamp;
|
|
22607
|
+
attemptEndInfo.endTimestamp = /* @__PURE__ */ new Date();
|
|
22608
|
+
}
|
|
22593
22609
|
backfillOperationInfo(attemptEndInfo, opInfo);
|
|
22594
22610
|
await plugin.onOperationAttemptEnd?.(attemptEndInfo);
|
|
22595
22611
|
await plugin.onOperationEnd?.({ ...attemptEndInfo, isReplay: false });
|
|
@@ -25134,7 +25150,7 @@ var DurableContextImpl = class {
|
|
|
25134
25150
|
stepInternal(pluginOperationName, nameOrFn, fnOrOptions, maybeOptions) {
|
|
25135
25151
|
validateContextUsage(this._stepPrefix, "step", this._executionContext.terminationManager);
|
|
25136
25152
|
return this.withDurableModeManagement(() => {
|
|
25137
|
-
const stepHandler = createStepHandler(this._executionContext, this.checkpoint, this.lambdaContext, this.createStepId.bind(this), this.durableLogger, this._parentId, () => this._defaultSerdes, this.durableExecution.plugin, pluginOperationName, this._signal);
|
|
25153
|
+
const stepHandler = createStepHandler(this._executionContext, this.checkpoint, this.lambdaContext, this.createStepId.bind(this), this.durableLogger, this._parentId, () => this._defaultSerdes, this.durableExecution.plugin, pluginOperationName, this._signal, this.durableExecution.defaultStepSemantics);
|
|
25138
25154
|
return stepHandler(nameOrFn, fnOrOptions, maybeOptions);
|
|
25139
25155
|
});
|
|
25140
25156
|
}
|
|
@@ -25622,7 +25638,7 @@ var CheckpointManager = class {
|
|
|
25622
25638
|
}
|
|
25623
25639
|
});
|
|
25624
25640
|
}
|
|
25625
|
-
async checkpoint(stepId, data) {
|
|
25641
|
+
async checkpoint(stepId, data, options) {
|
|
25626
25642
|
if (this.isTerminating) {
|
|
25627
25643
|
log("\u26A0\uFE0F", "Checkpoint skipped - manager is terminating or disposed:", {
|
|
25628
25644
|
stepId
|
|
@@ -25632,7 +25648,9 @@ var CheckpointManager = class {
|
|
|
25632
25648
|
}
|
|
25633
25649
|
if (this.hasFinishedAncestor(stepId)) {
|
|
25634
25650
|
log("\u26A0\uFE0F", "Checkpoint skipped - ancestor already finished:", { stepId });
|
|
25635
|
-
|
|
25651
|
+
if (options?.awaited !== false) {
|
|
25652
|
+
this.releaseAbandonedOperation(stepId, data);
|
|
25653
|
+
}
|
|
25636
25654
|
return new Promise(() => {
|
|
25637
25655
|
});
|
|
25638
25656
|
}
|
|
@@ -26452,7 +26470,7 @@ function isInLambdaRuntime() {
|
|
|
26452
26470
|
}
|
|
26453
26471
|
var isRuntimeBundled = isInLambdaRuntime();
|
|
26454
26472
|
var SDK_NAME = "aws-durable-execution-sdk-js";
|
|
26455
|
-
var baseVersion = "3.
|
|
26473
|
+
var baseVersion = "3.2.0";
|
|
26456
26474
|
var SDK_VERSION = isRuntimeBundled ? `${baseVersion}-bundled` : baseVersion;
|
|
26457
26475
|
var lambdaModulePromise;
|
|
26458
26476
|
var defaultLambdaClient;
|
|
@@ -27202,7 +27220,8 @@ async function runHandler(event, context, executionContext, durableExecutionMode
|
|
|
27202
27220
|
checkpointManager,
|
|
27203
27221
|
stepDataEmitter,
|
|
27204
27222
|
plugin,
|
|
27205
|
-
setTerminating: () => checkpointManager.setTerminating()
|
|
27223
|
+
setTerminating: () => checkpointManager.setTerminating(),
|
|
27224
|
+
defaultStepSemantics: config?.defaultStepSemantics
|
|
27206
27225
|
};
|
|
27207
27226
|
const rootPreserveChildDepth = resolveRootPreserveChildDepth(config?.pluginsConfig?.childOperationsDepth);
|
|
27208
27227
|
const durableContext = createDurableContext(
|
|
@@ -27414,6 +27433,21 @@ async function runHandler(event, context, executionContext, durableExecutionMode
|
|
|
27414
27433
|
} catch (waitError) {
|
|
27415
27434
|
log("\u26A0\uFE0F", "Error waiting for checkpoint queue completion:", waitError);
|
|
27416
27435
|
}
|
|
27436
|
+
if (executionContext.terminationManager.isTerminationRequested() && !durableExecution.checkpointManager.isCheckpointTokenRevoked()) {
|
|
27437
|
+
const lateTermination = await executionContext.terminationManager.getTerminationPromise();
|
|
27438
|
+
if (lateTermination.reason === TerminationReason.CHECKPOINT_FAILED && isUnrecoverableInvocationError(lateTermination.error)) {
|
|
27439
|
+
log("\u{1F6D1}", "Checkpoint failed after the handler threw");
|
|
27440
|
+
await plugin.onInvocationEnd?.({
|
|
27441
|
+
...invocationBaseInfo,
|
|
27442
|
+
status: PluginInvocationStatus.RETRYING,
|
|
27443
|
+
executionInput: customerHandlerEvent,
|
|
27444
|
+
executionError: lateTermination.error,
|
|
27445
|
+
executionResult: void 0,
|
|
27446
|
+
operations: toOperationInfoMap(executionContext._stepData)
|
|
27447
|
+
});
|
|
27448
|
+
throw lateTermination.error;
|
|
27449
|
+
}
|
|
27450
|
+
}
|
|
27417
27451
|
if (durableExecution.checkpointManager.isCheckpointTokenRevoked()) {
|
|
27418
27452
|
log("\u{1F6D1}", "Checkpoint token withdrawn - answering PENDING");
|
|
27419
27453
|
return await answerPending(error instanceof Error ? error : new Error(String(error)));
|