Hey,
I have an activity wherein I use googleclient to Download a file, and return the file as byte.
I keep getting “context deadline exceeded” errors in it.
Here is the activity code:
func (a *Activities) DownloadFile(ctx context.Context, fileId string, fileName string) ([]byte, error) {
logger := activity.GetLogger(ctx)
logger.Info("Downloading file from Google Drive...")
timeValue, _ := ctx.Deadline()
logger.Info(timeValue.GoString())
data, _ := a.FileSrv.Files.Get(fileId).Download()
defer data.Body.Close()
body, err := ioutil.ReadAll(data.Body)
if err != nil {
logger.Error("Error while reading response body")
return nil, err
}
return body, nil
}
Here is the workflow function::
func FileProcessingWorkflow(ctx workflow.Context, record *CsvRecord) (string, error) {
logger := workflow.GetLogger(ctx)
options := workflow.ActivityOptions{
StartToCloseTimeout: time.Second * 60,
RetryPolicy: &temporal.RetryPolicy{
MaximumAttempts: 3,
},
}
var a *Activities
logger.Info("Starting activity execution...")
ctx = workflow.WithActivityOptions(ctx, options)
var result []byte
//TODO: Fetch user id and bank statement drive ID here
logger.Info("Executing download statement Activity")
err := workflow.ExecuteActivity(ctx, a.DownloadFile, record.FileId, record.FileName).Get(ctx, &result)
if err != nil {
return "", err
}
//process the []byte further
}
Any pointers where I might be going wrong
I am running the basic docker-compose version on an M1 Mac