#Can't call Service.Sync()

1 messages · Page 1 of 1 (latest)

nimble nova
#

It looks like I can't call Service.Sync(). How do I block until a service is terminated?

#

Note: this is something I can do with Container

lusty oasis
#

Are you looking for Service.Stop()? Or what is the goal?

nimble nova
#

Before 0.9., I achieved this with Container.Sync

potent finch
#

I guess the equivalent is Start now?

#

Oh! Start doesn't wait for the service to finish. Yeah.. seems like a single call which starts the service and waits is not there in the service type

nimble nova
#

I think that's actually OK (at least in Go), I can call Start() then block manually on the context

lusty oasis
#

Since it's not listening on a port, would you still use Container.Sync and dagger call instead of Service/up?

nimble nova
#

Maybe. I was wondering that.

#

But now that I got my function working with dagger up (by exposing a bogus port), it feels right to have it be a service

#

It does pose the question of what exactly is and isn't a service

#

If I had my function return a *Container instead, and made no other change, I would lose the ability to run that container from the CLI, since there is no dagger run that takes a function returning a container, and runs that container

#

Ie:

  • dagger up -m github.com/shykes/daggerverse/tailscale gateway --> this works right now 🙂

  • dagger call -m github.com/shykes/daggerverse/tailscale gateway -> this wouldn't do anything, I think

#

Maybe dagger up should support Container in addition to Service, and just run the container as is?