beamable / BeamableProduct

The beamable product suite including com.beamable, com.beamable.server, microservice base image, portal, the installer, and build scripts
Other
3 stars 0 forks source link

CLI - make it possible to cancel the deployment at any moment #3480

Open gabrielbeamable opened 3 weeks ago

gabrielbeamable commented 3 weeks ago

Context is that in Unity editor you can cancel the deployment and it makes sense to do that in case you forgot something or decided that you don't want to deploy anymore, however that only closes the window in the Editor, the deployment process continues. Is there already a way to do this? Couldn't find it so leaving this issue here.

cdhanna commented 2 weeks ago

The CLI binding code from Unity needs a cancellation mechanism that will cancel the HTTP request to the CLI server. Then, the CLI server needs to kill the execution of a command when the originating HTTP request dies. (this is done via the AppLifecycle.Cancel() call in the data reporter

The existing AppLifecycle type has a DI level CancellationToken, but different commands use it or don't, which means we need the services deploy to use the cancellation token.

Worst Worst case is to kill the ENTIRE server (which will have collateral damage), but would technically work.


Its unclear how we'd set this up in Unity to make the cancellation of a command ergonomic without introducing state in new places.

        public async void Test()
        {
            var ctx = await BeamEditorContext.Default.Instance;
            var command = ctx.Cli.ServicesDeploy(null);

            // command.Cancel?
            var promise = command.Run();
            var promise2 = command.Run();
        }