Skip to content

Commit

Permalink
[dss][scd] DSS0210,A2-7-2,4d: Consider expired subscriptions as delet…
Browse files Browse the repository at this point in the history
…ed (#1013)

* [dss][scd] DSS0210,A2-7-2,4d: Do not return expired subscriptions in QuerySubscriptions

* Update reference to decision
  • Loading branch information
barroco authored Mar 28, 2024
1 parent a8b24c4 commit 8e3f849
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/scd/subscriptions_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package scd

import (
"context"
"time"

"github.com/golang/geo/s2"
"github.com/interuss/dss/pkg/api"
Expand Down Expand Up @@ -375,6 +376,7 @@ func (a *Server) GetSubscription(ctx context.Context, req *restapi.GetSubscripti
// QuerySubscriptions queries existing subscriptions in the given bounds.
func (a *Server) QuerySubscriptions(ctx context.Context, req *restapi.QuerySubscriptionsRequest,
) restapi.QuerySubscriptionsResponseSet {
nowMarker := time.Now()
if req.Auth.Error != nil {
resp := restapi.QuerySubscriptionsResponseSet{}
setAuthError(ctx, stacktrace.Propagate(req.Auth.Error, "Auth failed"), &resp.Response401, &resp.Response403, &resp.Response500)
Expand Down Expand Up @@ -419,7 +421,10 @@ func (a *Server) QuerySubscriptions(ctx context.Context, req *restapi.QuerySubsc
Subscriptions: make([]restapi.Subscription, 0),
}
for _, sub := range subs {
if sub.Manager == dssmodels.Manager(*req.Auth.ClientID) {
// Do not return subscriptions which are expired.
// This implementation decision is described and motivated in https://github.com/interuss/tsc/pull/12.
isExpired := sub.EndTime.Before(nowMarker)
if !isExpired && sub.Manager == dssmodels.Manager(*req.Auth.ClientID) {
// Get dependent Operations
dependentOps, err := r.GetDependentOperationalIntents(ctx, sub.ID)
if err != nil {
Expand Down

0 comments on commit 8e3f849

Please sign in to comment.