Skip to content

Commit 85aeaa5

Browse files
committed
Update activity started time after leader election
1 parent 2429e44 commit 85aeaa5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

components/ws-manager-mk2/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"fmt"
1212
"net"
1313
"os"
14+
"time"
1415

1516
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
1617
// to ensure that exec-entrypoint and run can make use of them.
@@ -153,6 +154,13 @@ func main() {
153154

154155
activity := activity.NewWorkspaceActivity()
155156

157+
go func() {
158+
for {
159+
<-mgr.Elected()
160+
activity.ManagerStartedAt = time.Now()
161+
}
162+
}()
163+
156164
timeoutReconciler, err := controllers.NewTimeoutReconciler(mgr.GetClient(), mgr.GetEventRecorderFor("workspace"), cfg.Manager, activity, maintenanceReconciler)
157165
if err != nil {
158166
setupLog.Error(err, "unable to create timeout controller", "controller", "Timeout")

0 commit comments

Comments
 (0)