Skip to content

Commit

Permalink
fix: better wait logic
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcStdt committed Jun 25, 2024
1 parent 7cfeb99 commit 229e309
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/minecraft/.scroll/scroll-lock.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"statuses":{"main.install":"done","main.start":"exit_code_1"},"scroll_version":"0.0.1","scroll_name":"registry-1.docker.io/highcard/scroll-minecraft-spigot"}
{"statuses":{"main.install":"done","main.start":"running"},"scroll_version":"0.0.1","scroll_name":"registry-1.docker.io/highcard/scroll-minecraft-spigot"}
6 changes: 3 additions & 3 deletions internal/core/services/process_launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ func (sc *ProcedureLauncher) Run(cmd string, processId string, changeStatus bool
)
switch wait := proc.Wait.(type) {
case int: //run in go routine and wait for x seconds
go func() {
go func(procedure domain.Procedure) {
time.Sleep(time.Duration(wait) * time.Second)
sc.RunProcedure(proc, processId, cmd)
}()
sc.RunProcedure(&procedure, processId, cmd)
}(*proc)
case bool: //run in go routine maybe wait
if wait {
_, exitCode, err = sc.RunProcedure(proc, processId, cmd)
Expand Down

0 comments on commit 229e309

Please sign in to comment.