feat: wake reconciled sessions for queued dispatch
This commit is contained in:
@@ -44,6 +44,7 @@ type Options struct {
|
||||
Limits agentproto.Limits
|
||||
Now func() time.Time
|
||||
CursorKey []byte
|
||||
WakeClient func(string) bool
|
||||
}
|
||||
|
||||
type Service struct {
|
||||
@@ -53,6 +54,7 @@ type Service struct {
|
||||
limits agentproto.Limits
|
||||
now func() time.Time
|
||||
cursors *domain.CursorCodec
|
||||
wakeClient func(string) bool
|
||||
}
|
||||
|
||||
func NewService(options Options) (*Service, error) {
|
||||
@@ -82,7 +84,7 @@ func NewService(options Options) (*Service, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &Service{store: options.Store, defaultQueueTTL: options.DefaultQueueTTL, limits: options.Limits, now: options.Now, cursors: codec}, nil
|
||||
return &Service{store: options.Store, defaultQueueTTL: options.DefaultQueueTTL, limits: options.Limits, now: options.Now, cursors: codec, wakeClient: options.WakeClient}, nil
|
||||
}
|
||||
|
||||
func (service *Service) ListClients(ctx context.Context, request *rvboxv1.ListClientsRequest) (*rvboxv1.ListClientsResponse, error) {
|
||||
@@ -264,6 +266,9 @@ func (service *Service) RunCommand(ctx context.Context, request *rvboxv1.RunComm
|
||||
if err != nil {
|
||||
return nil, mapStoreError(err)
|
||||
}
|
||||
if service.wakeClient != nil {
|
||||
_ = service.wakeClient(request.GetTargetClientId())
|
||||
}
|
||||
return &rvboxv1.RunCommandResponse{IssueUuid: issue.String(), Lifecycle: rvboxv1.CommandLifecycle(queued.Lifecycle)}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user