feat(btc): update chuunk size

Co-authored-by: Gaze <dev@gaze.network>
This commit is contained in:
Gaze
2024-04-18 00:03:02 +07:00
parent 07b1f864c1
commit 0fa6d77b4d
2 changed files with 6 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ import (
)
const (
blockStreamChunkSize = 2
blockStreamChunkSize = 5
)
// Make sure to implement the BitcoinDatasource interface

View File

@@ -17,6 +17,10 @@ import (
// TODO: Refactor this, datasources.BitcoinNode and This package is the same.
const (
blockStreamChunkSize = 100
)
// Make sure to implement the BitcoinDatasource interface
var _ datasources.Datasource[[]*types.Block] = (*ClientDatabase)(nil)
@@ -132,7 +136,7 @@ func (c *ClientDatabase) FetchAsync(ctx context.Context, from, to int64, ch chan
go func() {
defer stream.Close()
done := subscription.Done()
chunks := lo.Chunk(blockHeights, 100)
chunks := lo.Chunk(blockHeights, blockStreamChunkSize)
for _, chunk := range chunks {
chunk := chunk
select {