onResume method
Callback when this executor is resumed. Returns true if successfully resumed, false otherwise.
Implementation
@override
Future<bool> onResume() async {
if (deployment?.deployed == null) {
warning(
'$runtimeType - This deployment does not have a start time. Cannot execute this trigger.',
);
return false;
}
if (configuration?.elapsedTime == null) {
warning(
'$runtimeType - This ElapsedTimeTrigger does not have a elapsedTime specified. Cannot execute this trigger.',
);
return false;
}
int delay =
configuration!.elapsedTime!.inMilliseconds -
(DateTime.now().millisecondsSinceEpoch -
(deployment?.deployed.millisecondsSinceEpoch ?? 0));
if (delay > 0) {
timer = Timer(Duration(milliseconds: delay), () => onTrigger());
} else {
warning(
'$runtimeType - the trigger time is in the past and should have happened already.',
);
return false;
}
return true;
}