Skip to content

Commit 2c0cba0

Browse files
committed
fix: auto retry every 30seconds in case the status change without our notice
1 parent c376f80 commit 2c0cba0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

web/instances.go

+12
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ func ListenInstance(reconciler *controllers.InstancierReconciler) func(http.Resp
8888
}
8989
conn.WriteJSON(status)
9090

91+
// While the connection is alive, we'll send the status every 30 seconds, to be sure we're not stucking the user
92+
go func() {
93+
for {
94+
time.Sleep(30 * time.Second)
95+
status, _ := reconciler.GetInstance(challengeId, instanceId)
96+
err := conn.WriteJSON(status)
97+
if err != nil {
98+
return
99+
}
100+
}
101+
}()
102+
91103
for range worker.Channel {
92104
time.Sleep(1 * time.Second)
93105
status, _ := reconciler.GetInstance(challengeId, instanceId)

0 commit comments

Comments
 (0)