Refactor Oc-Sheduler

This commit is contained in:
mr
2026-03-25 11:11:37 +01:00
parent 7cbe08f4ea
commit 12eba65a01
24 changed files with 3498 additions and 2047 deletions

4
ws.go
View File

@@ -27,7 +27,7 @@ func main() {
token := ""
// Body JSON envoyé comme premier message WebSocket (WorkflowSchedule).
// Seuls start + duration_s sont requis si as_possible=true.
body := `{"start":"` + time.Now().UTC().Format(time.RFC3339) + `","duration_s":3600}`
body := `{"start":"` + time.Now().UTC().Format(time.RFC3339) + `"}`
if len(args) >= 1 {
url = args[0]
@@ -104,7 +104,7 @@ func main() {
return
case <-dateChangeTick.C:
newStart := time.Now().UTC().Add(3 * time.Minute)
update := `{"start":"` + newStart.Format(time.RFC3339) + `","duration_s":3600}`
update := `{"start":"` + newStart.Format(time.RFC3339) + `"}`
fmt.Printf("\n[sim] Envoi mise à jour de date → %s\n\n", update)
if err := websocket.Message.Send(ws, update); err != nil {
fmt.Printf("Erreur envoi mise à jour : %v\n", err)