mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-11 23:18:07 -05:00
Compare commits
1 Commits
develop
...
feat/debug
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fd6fea95f |
@@ -74,6 +74,10 @@ func (*Batch) TableName() string {
|
|||||||
// GetUnassignedBatch retrieves unassigned batch based on the specified limit.
|
// GetUnassignedBatch retrieves unassigned batch based on the specified limit.
|
||||||
// The returned batch are sorted in ascending order by their index.
|
// The returned batch are sorted in ascending order by their index.
|
||||||
func (o *Batch) GetUnassignedBatch(ctx context.Context, maxActiveAttempts, maxTotalAttempts uint8) (*Batch, error) {
|
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 := o.db.WithContext(ctx)
|
||||||
db = db.Where("proving_status = ?", int(types.ProvingTaskUnassigned))
|
db = db.Where("proving_status = ?", int(types.ProvingTaskUnassigned))
|
||||||
db = db.Where("total_attempts < ?", maxTotalAttempts)
|
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.
|
// GetAssignedBatch retrieves assigned batch based on the specified limit.
|
||||||
// The returned batch are sorted in ascending order by their index.
|
// The returned batch are sorted in ascending order by their index.
|
||||||
func (o *Batch) GetAssignedBatch(ctx context.Context, maxActiveAttempts, maxTotalAttempts uint8) (*Batch, error) {
|
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 := o.db.WithContext(ctx)
|
||||||
db = db.Where("proving_status = ?", int(types.ProvingTaskAssigned))
|
db = db.Where("proving_status = ?", int(types.ProvingTaskAssigned))
|
||||||
db = db.Where("total_attempts < ?", maxTotalAttempts)
|
db = db.Where("total_attempts < ?", maxTotalAttempts)
|
||||||
|
|||||||
@@ -69,6 +69,10 @@ func (*Chunk) TableName() string {
|
|||||||
// GetUnassignedChunk retrieves unassigned chunk based on the specified limit.
|
// GetUnassignedChunk retrieves unassigned chunk based on the specified limit.
|
||||||
// The returned chunks are sorted in ascending order by their index.
|
// 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) {
|
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 := o.db.WithContext(ctx)
|
||||||
db = db.Model(&Chunk{})
|
db = db.Model(&Chunk{})
|
||||||
db = db.Where("proving_status = ?", int(types.ProvingTaskUnassigned))
|
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.
|
// GetAssignedChunk retrieves assigned chunk based on the specified limit.
|
||||||
// The returned chunks are sorted in ascending order by their index.
|
// 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) {
|
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 := o.db.WithContext(ctx)
|
||||||
db = db.Model(&Chunk{})
|
db = db.Model(&Chunk{})
|
||||||
db = db.Where("proving_status = ?", int(types.ProvingTaskAssigned))
|
db = db.Where("proving_status = ?", int(types.ProvingTaskAssigned))
|
||||||
|
|||||||
2
l2geth
2
l2geth
Submodule l2geth updated: 25fe3ba69a...38a3a9c919
Reference in New Issue
Block a user