Skip to content

Commit

Permalink
perf(coordinator): optimize get task's optimistic lock (#960)
Browse files Browse the repository at this point in the history
Co-authored-by: georgehao <[email protected]>
Co-authored-by: colinlyguo <[email protected]>
  • Loading branch information
3 people authored Sep 21, 2023
1 parent 20c5e98 commit 59a2f1e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime/debug"
)

var tag = "v4.3.13"
var tag = "v4.3.14"

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
Expand Down
2 changes: 2 additions & 0 deletions coordinator/internal/logic/provertask/batch_prover_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"time"

"github.com/gin-gonic/gin"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -80,6 +81,7 @@ func (bp *BatchProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
}

if rowsAffected == 0 {
time.Sleep(100 * time.Millisecond)
continue
}

Expand Down
2 changes: 2 additions & 0 deletions coordinator/internal/logic/provertask/chunk_prover_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"time"

"github.com/gin-gonic/gin"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -84,6 +85,7 @@ func (cp *ChunkProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
}

if rowsAffected == 0 {
time.Sleep(100 * time.Millisecond)
continue
}

Expand Down
1 change: 0 additions & 1 deletion coordinator/internal/orm/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func (o *Batch) GetUnassignedBatch(ctx context.Context, maxActiveAttempts, maxTo
db = db.Where("total_attempts < ?", maxTotalAttempts)
db = db.Where("active_attempts < ?", maxActiveAttempts)
db = db.Where("chunk_proofs_status = ?", int(types.ChunkProofsStatusReady))
db = db.Order("index ASC")

var batch Batch
err := db.First(&batch).Error
Expand Down
1 change: 0 additions & 1 deletion coordinator/internal/orm/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func (o *Chunk) GetUnassignedChunk(ctx context.Context, height int, maxActiveAtt
db = db.Where("total_attempts < ?", maxTotalAttempts)
db = db.Where("active_attempts < ?", maxActiveAttempts)
db = db.Where("end_block_number <= ?", height)
db = db.Order("index ASC")

var chunk Chunk
err := db.First(&chunk).Error
Expand Down

0 comments on commit 59a2f1e

Please sign in to comment.