This commit is contained in:
mr
2026-05-28 08:15:02 +02:00
parent 3be023b9af
commit 55c1b70064
7 changed files with 97 additions and 19 deletions
@@ -356,6 +356,25 @@ func (s *SchedulingResourcesService) HandleCreateBooking(bk *booking.Booking, ad
return !bk.IsDraft
}
// Booking destined for a known NANO — store as local proxy without planner
// check (the resource belongs to the NANO, not us). oc-discovery will
// forward to the NANO via a DTN-critical stream.
if bk.DestPeerID != "" && bk.DestPeerID != self.GetID() {
d := oclib.NewRequestAdmin(oclib.LibDataEnum(oclib.PEER), nil).Search(&dbs.Filters{
And: map[string][]dbs.Filter{
"id": {{Operator: dbs.EQUAL.String(), Value: bk.DestPeerID}},
"relation": {{Operator: dbs.EQUAL.String(), Value: peer.NANO}},
},
}, "", false, 0, 1)
if len(d.Data) > 0 {
bk.IsDraft = true
if stored, _, err := booking.NewAccessor(adminReq).StoreOne(bk); err == nil {
time.AfterFunc(10*time.Minute, func() { DraftTimeout(stored.GetID(), tools.BOOKING) })
}
}
return false
}
// New booking
if !bk.ExpectedStartDate.IsZero() && bk.ExpectedStartDate.Before(time.Now().UTC()) {
fmt.Println("HandleCreateBooking: start date in the past, discarding")