Skip to content

Commit

Permalink
fix: use 2 clients
Browse files Browse the repository at this point in the history
  • Loading branch information
acha-bill committed Dec 14, 2024
1 parent 532dd27 commit 73fea06
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pkg/check/feed/feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ func (c *Check) regular(ctx context.Context, cluster orchestration.Cluster, o Op
if err != nil {
return err
}
client := clients[nodeName]
upClient := clients[nodeName]

batchID, err := client.GetOrCreateMutableBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel)
batchID, err := upClient.GetOrCreateMutableBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel)
if err != nil {
return err
}
Expand All @@ -109,7 +109,7 @@ func (c *Check) regular(ctx context.Context, cluster orchestration.Cluster, o Op
}

// create root
createManifestRes, err := client.CreateRootFeedManifest(ctx, signer, topic, api.UploadOptions{BatchID: batchID})
createManifestRes, err := upClient.CreateRootFeedManifest(ctx, signer, topic, api.UploadOptions{BatchID: batchID})
if err != nil {
return err
}
Expand All @@ -124,15 +124,15 @@ func (c *Check) regular(ctx context.Context, cluster orchestration.Cluster, o Op
data := fmt.Sprintf("update-%d", i)
fName := fmt.Sprintf("file-%d", i)
file := bee.NewBufferFile(fName, bytes.NewBuffer([]byte(data)))
err = client.UploadFile(context.Background(), &file, api.UploadOptions{
err = upClient.UploadFile(context.Background(), &file, api.UploadOptions{
BatchID: batchID,
Direct: true,
})
if err != nil {
return err
}
ref := file.Address()
socRes, err := client.UpdateFeedWithReference(ctx, signer, topic, uint64(i), ref, api.UploadOptions{BatchID: batchID})
socRes, err := upClient.UpdateFeedWithReference(ctx, signer, topic, uint64(i), ref, api.UploadOptions{BatchID: batchID})
if err != nil {
return err
}
Expand All @@ -144,12 +144,13 @@ func (c *Check) regular(ctx context.Context, cluster orchestration.Cluster, o Op

// fetch update
c.logger.Infof("fetching feed update")
update, err := client.FindFeedUpdate(ctx, signer, topic, nil)
downClient := clients[nodeNames[1]]
update, err := downClient.FindFeedUpdate(ctx, signer, topic, nil)
if err != nil {
return err
}

c.logger.Infof("node %s: feed update found", nodeName)
c.logger.Infof("node %s: feed update found", downClient.Name())
c.logger.Infof("reference: %d", update.Reference)
c.logger.Infof("index: %d", update.Index)
c.logger.Infof("next index: %d", update.NextIndex)
Expand All @@ -159,7 +160,7 @@ func (c *Check) regular(ctx context.Context, cluster orchestration.Cluster, o Op
}

// fetch feed via bzz
d, err := client.DownloadFileBytes(ctx, createManifestRes.Reference, nil)
d, err := downClient.DownloadFileBytes(ctx, createManifestRes.Reference, nil)
if err != nil {
return fmt.Errorf("download root feed: %w", err)
}
Expand Down

0 comments on commit 73fea06

Please sign in to comment.