]> git.giacomolli.uk - onechat/blobdiff - build_run.go
Separate multiline Go statements
[onechat] / build_run.go
index da75679d321cd31e0ea3a74f9b770c8b874d63c6..707a928070cc0452940b4a7dd434120085779277 100644 (file)
@@ -19,12 +19,12 @@ import (
 // buildLineBytes is the most bytes of one line in a build input or usage log.
 const buildLineBytes = 1 << 20
 
 // buildLineBytes is the most bytes of one line in a build input or usage log.
 const buildLineBytes = 1 << 20
 
+// buildWaitTimeout is the longest wait for pending memory builds.
+const buildWaitTimeout = time.Second
+
 // buildQuotaLimit is the largest increase in used quota points of a run.
 const buildQuotaLimit = 15.0
 
 // buildQuotaLimit is the largest increase in used quota points of a run.
 const buildQuotaLimit = 15.0
 
-// buildCallLimit is the most model calls of a run.
-const buildCallLimit = 660
-
 // BuildRun appends messages, builds their tree, and stops the run by the rules
 // of buildStop.
 type BuildRun struct {
 // BuildRun appends messages, builds their tree, and stops the run by the rules
 // of buildStop.
 type BuildRun struct {
@@ -33,6 +33,13 @@ type BuildRun struct {
        usagePath string
 }
 
        usagePath string
 }
 
+// DatedMessage is one message with an optional RFC 3339 date.
+type DatedMessage struct {
+       Kind string `json:"kind"`
+       Text string `json:"text"`
+       Date string `json:"date,omitempty"`
+}
+
 // Run appends the entries. It waits for the builds only before a user message,
 // 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
 // Run appends the entries. It waits for the builds only before a user message,
 // 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
@@ -116,19 +123,12 @@ func (r *BuildRun) check() string {
 
 // waitBuilds waits up to one second without leaving a child context open.
 func (r *BuildRun) waitBuilds(ctx context.Context) error {
 
 // waitBuilds waits up to one second without leaving a child context open.
 func (r *BuildRun) waitBuilds(ctx context.Context) error {
-       ctx, cancel := context.WithTimeout(ctx, time.Second)
+       ctx, cancel := context.WithTimeout(ctx, buildWaitTimeout)
        defer cancel()
 
        return r.memory.Wait(ctx)
 }
 
        defer cancel()
 
        return r.memory.Wait(ctx)
 }
 
-// DatedMessage is one message with an optional RFC 3339 date.
-type DatedMessage struct {
-       Kind string `json:"kind"`
-       Text string `json:"text"`
-       Date string `json:"date,omitempty"`
-}
-
 // buildReadUsage reads the records of usage.jsonl at path, in the order of the
 // start of their calls. The file has them in the order of the end of their
 // calls, which differs when calls run at once.
 // buildReadUsage reads the records of usage.jsonl at path, in the order of the
 // start of their calls. The file has them in the order of the end of their
 // calls, which differs when calls run at once.