How to Invoke the Scheduler before it reaches the Scheduled time?
Jul 16, 2024
08:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Jul 16, 2024
08:54 AM
How to Invoke the Scheduler before it reaches the Scheduled time?
Hi,
I would like to invoke the Scheduler, which will run the services needed for all the connected Things.
Do we have any Code Snippet that can do this?
Thanks,
Shashi Preetham,
Email: psp316r@outlook.com,
Mobile: +91 8099838001.
Email: psp316r@outlook.com,
Mobile: +91 8099838001.
Labels:
- Labels:
-
Best Practices
-
Coding
-
Examples
-
Install-Upgrade
1 REPLY 1
Jul 16, 2024
09:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Jul 16, 2024
09:31 AM
You can create a new ScheduledEvent which will cause the subscription to execute:
Things["YourScheduler_SL"].ScheduledEvent({timestamp: new Date()});
Question is if you want to do it this way, because it defeats the purpose of the scheduler, i.e. executing things on a fixed schedule.
This way, the subscription gets executed beyond schedule and users might wonder why/what happened.
It might be better to move all the subscription code to a service and then call the service directly.
