Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase timeouts for atx ops #106

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions storage/atx.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (s *Storage) InitActivationsStorage(ctx context.Context) error {
}

func (s *Storage) GetActivation(parent context.Context, query *bson.D) (*model.Activation, error) {
ctx, cancel := context.WithTimeout(parent, 5*time.Second)
ctx, cancel := context.WithTimeout(parent, 30*time.Second)
defer cancel()
cursor, err := s.db.Collection("activations").Find(ctx, query)
if err != nil {
Expand All @@ -53,7 +53,7 @@ func (s *Storage) GetActivation(parent context.Context, query *bson.D) (*model.A
}

func (s *Storage) GetActivationsCount(parent context.Context, query *bson.D, opts ...*options.CountOptions) int64 {
ctx, cancel := context.WithTimeout(parent, 5*time.Second)
ctx, cancel := context.WithTimeout(parent, 30*time.Second)
defer cancel()
count, err := s.db.Collection("activations").CountDocuments(ctx, query, opts...)
if err != nil {
Expand All @@ -64,7 +64,7 @@ func (s *Storage) GetActivationsCount(parent context.Context, query *bson.D, opt
}

func (s *Storage) GetActivations(parent context.Context, query *bson.D, opts ...*options.FindOptions) ([]bson.D, error) {
ctx, cancel := context.WithTimeout(parent, 5*time.Second)
ctx, cancel := context.WithTimeout(parent, 30*time.Second)
defer cancel()
cursor, err := s.db.Collection("activations").Find(ctx, query, opts...)
if err != nil {
Expand All @@ -85,7 +85,7 @@ func (s *Storage) GetActivations(parent context.Context, query *bson.D, opts ...
}

func (s *Storage) SaveActivation(parent context.Context, in *model.Activation) error {
ctx, cancel := context.WithTimeout(parent, 5*time.Second)
ctx, cancel := context.WithTimeout(parent, 30*time.Second)
defer cancel()
_, err := s.db.Collection("activations").InsertOne(ctx, bson.D{
{Key: "id", Value: in.Id},
Expand All @@ -104,7 +104,7 @@ func (s *Storage) SaveActivation(parent context.Context, in *model.Activation) e
}

func (s *Storage) SaveActivations(parent context.Context, in []*model.Activation) error {
ctx, cancel := context.WithTimeout(parent, 10*time.Second)
ctx, cancel := context.WithTimeout(parent, 30*time.Second)
defer cancel()
for _, atx := range in {
_, err := s.db.Collection("activations").InsertOne(ctx, bson.D{
Expand Down
Loading