spin icon indicating copy to clipboard operation
spin copied to clipboard

SIP: Clock Trigger

Open fibonacci1729 opened this issue 2 years ago • 7 comments

Rendered

Signed-off-by: Brian H [email protected]

fibonacci1729 avatar May 23 '22 18:05 fibonacci1729

#365

fibonacci1729 avatar May 23 '22 18:05 fibonacci1729

I want something to execute on start, and never again (0 0 5 31 2 ?)

Would this be a supported feature? Some schedulers error out on runaway dates.

ecumene avatar Jun 26 '22 13:06 ecumene

@ecumene

I want something to execute on start, and never again

Could you expound on what you want to do here? It seems like you could basically get this effect with e.g.

interval = "infinity" # or... "999 years"
on_start = true

...but the specific point of time "on start" is sort of a weird concept for Spin.

lann avatar Jun 27 '22 13:06 lann

interval = "infinity" works!

I want "on start" to run some code that registers callbacks with another service before starting my app. In the future, I also want to do some template rendering before running the services. I could also write a script in JS/Python to do this but it would be convenient to use the framework.

Obviously this isn't quite a "microservice". Maybe I can work around this if doesn't make sense😆

ecumene avatar Jun 27 '22 17:06 ecumene

I want "on start" to run some code that registers callbacks with another service before starting my app.

This is an interesting one - sounds like you're basically doing a sort of service discovery registration. Would you mind giving a little more detail here?

I also want to do some template rendering before running the services

Depending on exactly what you need, you might be interested in wizer. I think we'll probably bake it (or something equivalent) into spin eventually.

lann avatar Jun 27 '22 18:06 lann

service discovery registration

I'm actually registering a discord command. Right now, it does it on the event that's meant for ping (😬)

Depending on exactly what you need, you might be interested in wizer.

Thanks! I'll look into that

ecumene avatar Jun 27 '22 18:06 ecumene

service discovery registration

I'm actually registering a discord command. Right now, it does it on the event that's meant for ping (grimacing)

Makes sense. I'm mostly just trying to get a sense of whether there is a more general use for an "on start" entrypoint, independent of this clock trigger. This seems like a pretty good example.

lann avatar Jun 27 '22 18:06 lann