Open dthul opened 5 years ago
If you're using a closure to schedule a task, you could use a mutable DateTime that's moved with the closure to keep track of that. Having access to Context would only be useful for listing all of the scheduled tasks without consuming them. But a way to delete tasks early isn't even implemented.
Fair enough. I just thought that since the time is already part of the context, an accessor method would give that feature "for free" (making it part of the public API though, which requires some consideration).
Hello, dthul!
I see your concern, I will consider granting access to the field! Requesting the current time might be preciser as time taken from the scheduler to note an item being due and issue the dispatch to the actual scheduled item is unknown. Either way, I will look into this.
Tasks are handed a Context reference on execution. I would like to access the context's time to schedule a follow-up task based on it. The field is private though and there is no accessor method. (I know that I could just call now() to get the current time, which should be almost equal to the time stored in the context. But then the task might be delayed slightly each time it is rescheduled).