Set up
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user