X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/7b6d0a81e0f3c8e33b1b76d5ecbc5bdb25a87249..503486b8364f07ef44c06bcc1be566f62600b0eb:/probe.go?ds=sidebyside diff --git a/probe.go b/probe.go index 32a3ba9..e12516d 100644 --- a/probe.go +++ b/probe.go @@ -40,10 +40,10 @@ const ( // the first failed call, after probeCallLimit calls, or when the used percent // of a quota window grows by more than probeQuotaLimit points. At the end it // reports the calls, the time per call, the calls at once, the cached share, -// the quota, the retries, and the line sizes. BUILDS, from 1 to maxBuilds, +// the quota, the retries, and the line sizes. BUILDS, from 1 to buildMax, // limits the builds that call the model at once in this run only. The core -// still queues up to maxBuilds builds. The run holds the lock of the token -// file, so it does not run while the daemon runs. +// still queues up to buildMax builds. The run holds the lock of the token file, +// so it does not run while the daemon runs. func probe(ctx context.Context, args []string, out io.Writer) (err error) { if len(args) != 2 && len(args) != 3 { return errors.New("usage: onechat probe LOG COUNT [BUILDS]") @@ -54,11 +54,11 @@ func probe(ctx context.Context, args []string, out io.Writer) (err error) { return fmt.Errorf("COUNT %q is not a positive number", args[1]) } - builds := maxBuilds + builds := buildMax if len(args) == 3 { builds, err = strconv.Atoi(args[2]) - if err != nil || builds < 1 || builds > maxBuilds { - return fmt.Errorf("BUILDS %q is not a number from 1 to %d", args[2], maxBuilds) + if err != nil || builds < 1 || builds > buildMax { + return fmt.Errorf("BUILDS %q is not a number from 1 to %d", args[2], buildMax) } } @@ -145,10 +145,10 @@ type probeRun struct { } // Run appends the entries. It waits for the builds only before a user message, -// as a turn does, so up to maxBuilds builds run at once in between, and it -// waits for all builds at the end. It returns the number of messages appended -// and why the run stopped early, or "" when it did not. After a stop it waits -// for the calls in flight, so no sent call is cancelled. +// as a turn does, so up to buildMax builds run at once in between, and it waits +// for all builds at the end. It returns the number of messages appended and why +// the run stopped early, or "" when it did not. After a stop it waits for the +// calls in flight, so no sent call is cancelled. func (r *probeRun) Run(ctx context.Context, entries []probeEntry) (int, string) { appended, reason := r.append(ctx, entries) if reason == "" {