From f6a36f9028dc3f924583c83837a75e6a0a4ccbc3 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Sat, 3 Jun 2023 01:54:14 -0600 Subject: [PATCH] Added call to resource update in arena update --- event.go | 2 +- vex.go | 1 + vex_test.go | 11 ++++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/event.go b/event.go index fb2f350..585c9a5 100644 --- a/event.go +++ b/event.go @@ -356,7 +356,7 @@ func NewEventQueue(name string, description string, required_resources []Resourc err := LockResources(event) // start in new goroutine if err != nil { - log.Printf("Failed to lock %s: %s", event.Name(), err) + //log.Printf("Failed to lock %s: %s", event.Name(), err) } else { info.state = "running" log.Printf("EVENT_START: %s", event.Name()) diff --git a/vex.go b/vex.go index 141d0f6..8aa207c 100644 --- a/vex.go +++ b/vex.go @@ -96,6 +96,7 @@ func (arena * Arena) lock(event Event) error { func (arena * Arena) update(signal GraphSignal) { log.Printf("ARENA_UPDATE: %s", arena.Name()) + arena.BaseResource.update(signal) arena.signal <- signal } diff --git a/vex_test.go b/vex_test.go index 45b8634..b1422b7 100644 --- a/vex_test.go +++ b/vex_test.go @@ -150,14 +150,15 @@ func TestNewMatch(t *testing.T) { go func(match_c chan GraphSignal) { (*graph_tester)(t).CheckForValue(match_c, "no update to match after starting 1") - (*graph_tester)(t).CheckForNone(match_c, "update to match after starting 2") - SendUpdate(match, NewSignal(nil, "queue_autonomous")) + (*graph_tester)(t).CheckForValue(match_c, "no update to match after starting 2") + (*graph_tester)(t).CheckForNone(match_c, "update to match after starting 3") + SendUpdate(arena, NewSignal(nil, "queue_autonomous")) (*graph_tester)(t).CheckForValue(match_c, "no update to match after queueing autonomous 1") (*graph_tester)(t).CheckForValue(match_c, "no update to match after queueing autonomous 2") (*graph_tester)(t).CheckForNone(match_c, "update to match after queueing autonomous 3") auton_signal := NewSignal(nil, "start_autonomous") auton_signal.time = time.Now() - SendUpdate(match, auton_signal) + SendUpdate(arena, auton_signal) (*graph_tester)(t).CheckForValue(match_c, "no update to match after starting autonomous 1") (*graph_tester)(t).CheckForValue(match_c, "no update to match after starting autonomous 2") (*graph_tester)(t).CheckForNone(match_c, "update to match after starting autonomous 3") @@ -165,13 +166,13 @@ func TestNewMatch(t *testing.T) { time.Sleep(time.Millisecond * 100) (*graph_tester)(t).CheckForValue(match_c, "no update to match after ending autonomous 1") (*graph_tester)(t).CheckForNone(match_c, "update to match after ending autonomous 2") - SendUpdate(match, NewSignal(nil, "queue_driver")) + SendUpdate(arena, NewSignal(nil, "queue_driver")) (*graph_tester)(t).CheckForValue(match_c, "no update to match after queueing driver 1") (*graph_tester)(t).CheckForValue(match_c, "no update to match after queueing driver 2") (*graph_tester)(t).CheckForNone(match_c, "update to match after queueing driver 3") driver_signal := NewSignal(nil, "start_driver") driver_signal.time = time.Now() - SendUpdate(match, driver_signal) + SendUpdate(arena, driver_signal) (*graph_tester)(t).CheckForValue(match_c, "no update to match after starting driver 1") (*graph_tester)(t).CheckForValue(match_c, "no update to match after starting driver 2") (*graph_tester)(t).CheckForNone(match_c, "update to match after starting driver 3")