Skip to content

Commit

Permalink
Remove runtime limit/count reporting.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-as committed Oct 16, 2023
1 parent b5d6047 commit 67e6462
Show file tree
Hide file tree
Showing 26 changed files with 0 additions and 699 deletions.
28 changes: 0 additions & 28 deletions cmd/state-svc/internal/resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"time"

"github.com/ActiveState/cli/cmd/state-svc/internal/messages"
"github.com/ActiveState/cli/cmd/state-svc/internal/rtusage"
"github.com/ActiveState/cli/cmd/state-svc/internal/rtwatcher"
genserver "github.com/ActiveState/cli/cmd/state-svc/internal/server/generated"
"github.com/ActiveState/cli/internal/analytics/client/sync"
Expand All @@ -36,7 +35,6 @@ type Resolver struct {
messages *messages.Messages
updatePoller *poller.Poller
authPoller *poller.Poller
usageChecker *rtusage.Checker
projectIDCache *projectcache.ID
an *sync.Client
anForClient *sync.Client // Use separate client for events sent through service so we don't contaminate one with the other
Expand Down Expand Up @@ -73,8 +71,6 @@ func New(cfg *config.Instance, an *sync.Client, auth *authentication.Auth) (*Res
return nil, nil
})

usageChecker := rtusage.NewChecker(cfg, auth)

// Note: source does not matter here, as analytics sent via the resolver have a source
// (e.g. State Tool or Executor), and that source will be used.
anForClient := sync.New(anaConsts.SrcStateTool, cfg, auth, nil)
Expand All @@ -83,7 +79,6 @@ func New(cfg *config.Instance, an *sync.Client, auth *authentication.Auth) (*Res
msg,
pollUpdate,
pollAuth,
usageChecker,
projectcache.NewID(),
an,
anForClient,
Expand Down Expand Up @@ -235,29 +230,6 @@ func (r *Resolver) ReportRuntimeUsage(_ context.Context, pid int, exec, source s
return &graph.ReportRuntimeUsageResponse{Received: true}, nil
}

func (r *Resolver) CheckRuntimeUsage(_ context.Context, organizationName string) (*graph.CheckRuntimeUsageResponse, error) {
defer func() { handlePanics(recover(), debug.Stack()) }()

logging.Debug("CheckRuntimeUsage resolver")

usage, err := r.usageChecker.Check(organizationName)
if err != nil {
return nil, errs.Wrap(err, "Could not check runtime usage: %s", errs.JoinMessage(err))
}

if usage == nil {
return &graph.CheckRuntimeUsageResponse{
Limit: 1,
Usage: 0,
}, nil
}

return &graph.CheckRuntimeUsageResponse{
Limit: int(usage.LimitDynamicRuntimes),
Usage: int(usage.ActiveDynamicRuntimes),
}, nil
}

func (r *Resolver) CheckMessages(ctx context.Context, command string, flags []string) ([]*graph.MessageInfo, error) {
defer func() { handlePanics(recover(), debug.Stack()) }()
logging.Debug("Check messages resolver")
Expand Down
84 changes: 0 additions & 84 deletions cmd/state-svc/internal/rtusage/rtusage.go

This file was deleted.

Loading

0 comments on commit 67e6462

Please sign in to comment.