MCPcopy
hub / github.com/kopia/kopia / run

Method run

cli/command_server_throttle_set.go:27–50  ·  view source on GitHub ↗
(ctx context.Context, cli *apiclient.KopiaAPIClient)

Source from the content-addressed store, hash-verified

25}
26
27func (c *commandServerThrottleSet) run(ctx context.Context, cli *apiclient.KopiaAPIClient) error {
28 var limits throttling.Limits
29
30 if err := cli.Get(ctx, "control/throttle", nil, &limits); err != nil {
31 return errors.Wrap(err, "unable to get current throttle")
32 }
33
34 var changeCount int
35
36 if err := c.cts.apply(ctx, &limits, &changeCount); err != nil {
37 return err
38 }
39
40 if changeCount == 0 {
41 log(ctx).Info("No changes made.")
42 return nil
43 }
44
45 if err := cli.Put(ctx, "control/throttle", &limits, &serverapi.Empty{}); err != nil {
46 return errors.Wrap(err, "unable to change throttle")
47 }
48
49 return nil
50}

Callers

nothing calls this directly

Calls 4

applyMethod · 0.80
InfoMethod · 0.80
GetMethod · 0.65
PutMethod · 0.65

Tested by

no test coverage detected