mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-04 23:00:30 +08:00
Go: add context to storage (#17690)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -388,7 +388,7 @@ func storeAgentAttachment(ctx context.Context, docID string, payload []byte) (bo
|
||||
return false, fmt.Errorf("storage not initialized")
|
||||
}
|
||||
bucket := fmt.Sprintf("%s-downloads", tenantID)
|
||||
if err := storageImpl.Put(bucket, docID, payload); err != nil {
|
||||
if err = storageImpl.Put(ctx, bucket, docID, payload); err != nil {
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
|
||||
@@ -192,7 +192,7 @@ func TestDocsGenerator_Invoke_StoresAgentAttachment(t *testing.T) {
|
||||
}
|
||||
state := canvas.NewCanvasState("run-1", "task-1")
|
||||
state.Sys["tenant_id"] = "tenant-1"
|
||||
ctx := canvas.WithState(context.Background(), state)
|
||||
ctx := canvas.WithState(t.Context(), state)
|
||||
|
||||
out, err := c.Invoke(ctx, nil, map[string]any{})
|
||||
if err != nil {
|
||||
@@ -205,7 +205,7 @@ func TestDocsGenerator_Invoke_StoresAgentAttachment(t *testing.T) {
|
||||
if !ok || docID == "" {
|
||||
t.Fatalf("doc_id = %v, want non-empty string", out["doc_id"])
|
||||
}
|
||||
blob, err := memStorage.Get("tenant-1-downloads", docID)
|
||||
blob, err := memStorage.Get(ctx, "tenant-1-downloads", docID)
|
||||
if err != nil {
|
||||
t.Fatalf("stored blob missing: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user