graph-rework
noah metz 2023-06-20 16:22:22 -06:00
parent ff0f54ee88
commit b630c015df
2 changed files with 8 additions and 0 deletions

@ -309,9 +309,11 @@ func LockResources(event Event) error {
for _, resource := range(locked_resources) { for _, resource := range(locked_resources) {
UnlockResource(resource, event) UnlockResource(resource, event)
} }
log.Logf("event", "RESOURCE_LOCK_FAIL for %s: %s", event.Name(), lock_err)
return lock_err return lock_err
} }
log.Logf("event", "RESOURCE_LOCK_SUCCESS for %s", event.Name())
signal := NewDownSignal(event, "locked") signal := NewDownSignal(event, "locked")
SendUpdate(event, signal) SendUpdate(event, signal)

@ -52,10 +52,16 @@ type Resource interface {
LockState() LockState()
UnlockState() UnlockState()
String() string
lock(node GraphNode) error lock(node GraphNode) error
unlock(node GraphNode) error unlock(node GraphNode) error
} }
func (resource * BaseResource) String() string {
return resource.Name()
}
// Recurse up cur's parents to ensure r is not present // Recurse up cur's parents to ensure r is not present
func checkIfParent(r Resource, cur Resource) bool { func checkIfParent(r Resource, cur Resource) bool {
if r == nil || cur == nil { if r == nil || cur == nil {