Compare commits
2 Commits
19b96e64e1
...
ea41bef942
Author | SHA1 | Date | |
---|---|---|---|
ea41bef942 | |||
caef31f48f |
@ -2,6 +2,7 @@ package plug
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
|
|
||||||
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/database"
|
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/database"
|
||||||
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
|
"git.anthrove.art/Anthrove/otter-space-sdk/v3/pkg/models"
|
||||||
@ -57,6 +58,18 @@ func (s *server) TaskStart(ctx context.Context, creation *gRPC.PlugTaskCreation)
|
|||||||
}
|
}
|
||||||
span.AddEvent("Retrieved user source", trace.WithAttributes(attribute.String("user_source_id", creation.UserSourceId)))
|
span.AddEvent("Retrieved user source", trace.WithAttributes(attribute.String("user_source_id", creation.UserSourceId)))
|
||||||
|
|
||||||
|
if !userSource.AccountValidate {
|
||||||
|
err = errors.New("user is not validated")
|
||||||
|
|
||||||
|
log.WithContext(ctx).WithError(err).WithField("task_id", id).Error("Task execution failed")
|
||||||
|
span.RecordError(err)
|
||||||
|
span.SetStatus(codes.Error, err.Error())
|
||||||
|
|
||||||
|
plugTaskState.TaskState = gRPC.PlugTaskState_STOPPED
|
||||||
|
|
||||||
|
return &plugTaskState, err
|
||||||
|
}
|
||||||
|
|
||||||
// gRPC closes the context after the call ended. So the whole scrapping stopped without waiting
|
// gRPC closes the context after the call ended. So the whole scrapping stopped without waiting
|
||||||
// by using this method we assign a new context to each new request we get.
|
// by using this method we assign a new context to each new request we get.
|
||||||
// This can be used for example to close the context with the given id
|
// This can be used for example to close the context with the given id
|
||||||
|
Loading…
Reference in New Issue
Block a user