onResume method

  1. @override
Future<bool> onResume()
override

Callback when this executor is resumed. Returns true if successfully resumed, false otherwise.

Implementation

@override
Future<bool> onResume() async {
  if (!configuration!.hasBeenTriggered) {
    // Note that the trigger stamp is saved in the deployment configuration.
    // By called 'hasBeenUpdated', the deployment is marked as updated and
    // persisted with the new trigger timestamp.
    configuration!.triggerTimestamp = DateTime.now();
    deployment?.hasBeenUpdated();
    onTrigger();
  } else {
    warning(
      "$runtimeType - one time trigger already occurred at: ${configuration?.triggerTimestamp}. "
      'Will not trigger now.',
    );
    return false;
  }
  return true;
}