joinhaven / spark-coffee

Spark / Particle bot to Slack message when coffee is brewing / ready
1 stars 0 forks source link

Wait 10 minutes server-side? #1

Open shipstar opened 9 years ago

shipstar commented 9 years ago

Just curious. Any reason not to trigger the message client-side and then use setTimeout / cron / background job / etc on the server to trigger a follow-up 10 minutes later? Would free up your Spark Core to do what it's best at -- handle hardware inputs/outputs.

Thoughts if you didn't try it out? @chellberg and I may take on a version of this project sometime, so maybe I'll submit a PR or at least provide a link to the alternative.

panozzaj commented 9 years ago

Thanks for reading and thinking about this! Summarizing our conversation from last night and expanding a little.

I considered doing something like this, but it seems like there are two advantages at this time:

  1. the SparkCore would need to poll, which I didn't want to have to deal with (thought the network might be flaky?)
  2. we disable the button between "brewing" and "ready!", which again, would need to poll

But maybe the polling concern is overblown. If the SparkCore can receive network inputs, then this might be a cleaner solution. I think we are going to get another potential client of the server that would need to reimplement the same ten minute wait logic, so it might make sense to change this. Leaving open until I do more investigation. Particle Webhooks might be a useful investigation point.

Thanks again!