Skip to content

Commit

Permalink
Fix for occasional "Stream buffer tokens too high" error really fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
danenania committed May 16, 2024
1 parent 6d13da3 commit f075138
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/server/model/plan/build_fix_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (fileState *activeBuildStreamFileState) listenStreamFixChanges(stream *open
fileState.activeBuild.FixBufferTokens++

// After a reasonable threshhold, if buffer has significantly more tokens than original file + proposed changes, something is wrong
cutoff := int(math.Max(float64(fileState.activeBuild.CurrentFileTokens+fileState.activeBuild.FileContentTokens), 500) * 2)
cutoff := int(math.Max(float64(fileState.activeBuild.CurrentFileTokens+fileState.activeBuild.FileContentTokens), 500) * 20)
if fileState.activeBuild.FixBufferTokens > 500 && fileState.activeBuild.FixBufferTokens > cutoff {
log.Printf("File %s: Stream buffer tokens too high\n", filePath)
log.Printf("Current file tokens: %d\n", fileState.activeBuild.CurrentFileTokens)
Expand Down
2 changes: 1 addition & 1 deletion app/server/model/plan/build_stream_line_nums.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (fileState *activeBuildStreamFileState) listenStreamChangesWithLineNums(str
fileState.activeBuild.WithLineNumsBufferTokens++

// After a reasonable threshhold, if buffer has significantly more tokens than original file + proposed changes, something is wrong
cutoff := int(math.Max(float64(fileState.activeBuild.CurrentFileTokens+fileState.activeBuild.FileContentTokens), 500) * 2)
cutoff := int(math.Max(float64(fileState.activeBuild.CurrentFileTokens+fileState.activeBuild.FileContentTokens), 500) * 20)
if fileState.activeBuild.WithLineNumsBufferTokens > 500 && fileState.activeBuild.WithLineNumsBufferTokens > cutoff {
log.Printf("File %s: Stream buffer tokens too high\n", filePath)
log.Printf("Current file tokens: %d\n", fileState.activeBuild.CurrentFileTokens)
Expand Down

0 comments on commit f075138

Please sign in to comment.