Compare commits

...

1 Commits

Author SHA1 Message Date
georgehao
2fd6fea95f feat: debug performance 2024-03-26 13:34:53 +08:00
3 changed files with 17 additions and 1 deletions

View File

@@ -74,6 +74,10 @@ func (*Batch) TableName() string {
// GetUnassignedBatch retrieves unassigned batch based on the specified limit.
// The returned batch are sorted in ascending order by their index.
func (o *Batch) GetUnassignedBatch(ctx context.Context, maxActiveAttempts, maxTotalAttempts uint8) (*Batch, error) {
t := time.Now()
defer func() {
log.Info("GetUnassignedBatch cost", "duration(ms)", time.Since(t).Milliseconds())
}()
db := o.db.WithContext(ctx)
db = db.Where("proving_status = ?", int(types.ProvingTaskUnassigned))
db = db.Where("total_attempts < ?", maxTotalAttempts)
@@ -95,6 +99,10 @@ func (o *Batch) GetUnassignedBatch(ctx context.Context, maxActiveAttempts, maxTo
// GetAssignedBatch retrieves assigned batch based on the specified limit.
// The returned batch are sorted in ascending order by their index.
func (o *Batch) GetAssignedBatch(ctx context.Context, maxActiveAttempts, maxTotalAttempts uint8) (*Batch, error) {
t := time.Now()
defer func() {
log.Info("GetAssignedBatch cost", "duration(ms)", time.Since(t).Milliseconds())
}()
db := o.db.WithContext(ctx)
db = db.Where("proving_status = ?", int(types.ProvingTaskAssigned))
db = db.Where("total_attempts < ?", maxTotalAttempts)

View File

@@ -69,6 +69,10 @@ func (*Chunk) TableName() string {
// GetUnassignedChunk retrieves unassigned chunk based on the specified limit.
// The returned chunks are sorted in ascending order by their index.
func (o *Chunk) GetUnassignedChunk(ctx context.Context, height int, maxActiveAttempts, maxTotalAttempts uint8) (*Chunk, error) {
t := time.Now()
defer func() {
log.Info("GetUnassignedChunk cost", "duration(ms)", time.Since(t).Milliseconds())
}()
db := o.db.WithContext(ctx)
db = db.Model(&Chunk{})
db = db.Where("proving_status = ?", int(types.ProvingTaskUnassigned))
@@ -91,6 +95,10 @@ func (o *Chunk) GetUnassignedChunk(ctx context.Context, height int, maxActiveAtt
// GetAssignedChunk retrieves assigned chunk based on the specified limit.
// The returned chunks are sorted in ascending order by their index.
func (o *Chunk) GetAssignedChunk(ctx context.Context, height int, maxActiveAttempts, maxTotalAttempts uint8) (*Chunk, error) {
t := time.Now()
defer func() {
log.Info("GetAssignedChunk cost", "duration(ms)", time.Since(t).Milliseconds())
}()
db := o.db.WithContext(ctx)
db = db.Model(&Chunk{})
db = db.Where("proving_status = ?", int(types.ProvingTaskAssigned))

2
l2geth

Submodule l2geth updated: 25fe3ba69a...38a3a9c919