Skip to content

Commit d623baf

Browse files
committed
fix: GetFirstUnuploadedAndFailedBatch
1 parent e84a2b8 commit d623baf

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

rollup/internal/orm/batch.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,9 @@ func (o *Batch) GetBatchByIndex(ctx context.Context, index uint64) (*Batch, erro
268268
func (o *Batch) GetFirstUnuploadedAndFailedBatch(ctx context.Context, startBatch uint64, platform types.BlobStoragePlatform) (*Batch, error) {
269269
db := o.db.WithContext(ctx)
270270
db = db.Model(&Batch{})
271-
db = db.Joins("LEFT JOIN blob_upload ON blob_upload.batch_index = batch.index")
271+
db = db.Joins("LEFT JOIN blob_upload ON blob_upload.batch_index = batch.index AND blob_upload.platform = ?", platform)
272272
db = db.Where("batch.commit_tx_hash IS NOT NULL AND batch.index >= ?", startBatch)
273273
db = db.Where("blob_upload.batch_index IS NULL OR blob_upload.status = ?", types.BlobUploadStatusFailed)
274-
db = db.Where("blob_upload.platform = ?", platform)
275274
db = db.Order("batch.index ASC")
276275
db = db.Limit(1)
277276

0 commit comments

Comments
 (0)