Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove runtime limit/count reporting. #2822

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading