Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to create probe via sms #13

Closed
Tracked by #33
Daskott opened this issue Jan 1, 2022 · 0 comments · Fixed by #37
Closed
Tracked by #33

Ability to create probe via sms #13

Daskott opened this issue Jan 1, 2022 · 0 comments · Fixed by #37
Labels
enhancement New feature or request

Comments

@Daskott
Copy link
Owner

Daskott commented Jan 1, 2022

A user can text the server something like:

probe 15m

And a probe will sent to the user in 15m, with 0 retries. Can be done through scheduled jobs.

TODO:

  • user.probe_settings should have max_retries & wait_time_in_minutes(i.e. time to wait for a reply after which the probe is retried or is marked as unavailable)
  • When creating a probe use the users user.probe_settings to set max_retries & wait_time_in_minutes - they should also be fields in probe.
  • Add scheduledAt column to jobs table.
  • When user sends sms command, create a job added to the scheduled queue & set scheduledAt(i.e. when the job should be run)
  • Create a new worker that only pulls jobs from the scheduled queue & move them to the enqueued queue if scheduledAt <= time.Now()
  • The scheduled job should have ["probe_max_retries"] arg set to 0. So after the user's dynamic probe triggers, if they don't reply, immediately mark as unavailable & contact emergency contact.

Enhancement:

  • Move this logic into a database query:
    // Only send out followup probe after at least 1 hour after the last probe was sent,
    // until max-retries. So the user has enough time to respond.
    //
    // E.g sendInitialProbe @ 5:OOpm
    // Follow up 1 will be @ ~6:00pm
    // Follow up 2 will be @ ~7:00pm
    // Follow up 3 will be @ ~8:00pm
    //
    // And if no respons, @ ~9:00pm send out emergency probe
    if time.Since(*probe.UpdatedAt) < 1*time.Hour {
    continue
    }

Note:

  • Perhaps multiple retries & shorter wait times for dynamic probes
  • The ability to do this via text should be deprecated at some point, but the feature can still be used in a diff interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant