Skip to content

Commit

Permalink
Merge pull request #129 from xmidt-org/denopink/refactor/pubsub-defau…
Browse files Browse the repository at this point in the history
…lts-consistency-

refactor: Refactor pubsub package in order to keep defaults consistent
  • Loading branch information
schmidtw authored May 17, 2024
2 parents ff20e75 + 4db5804 commit 93bc3ae
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/xmidt-agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ var defaultConfig = Config{
},
},
Pubsub: Pubsub{
PublishTimeout: 200 * time.Millisecond,
PublishTimeout: 5 * time.Second,
},
Logger: sallust.Config{
EncoderConfig: sallust.EncoderConfig{
Expand Down
2 changes: 1 addition & 1 deletion internal/adapters/libparodus/end2end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func TestEnd2End(t *testing.T) {
require.NoError(err)
require.NotEmpty(self)

ps, err := pubsub.New(self)
ps, err := pubsub.New(self, pubsub.WithPublishTimeout(200*time.Millisecond))
require.NoError(err)
require.NotNil(ps)

Expand Down
1 change: 1 addition & 0 deletions internal/pubsub/end2end_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ func TestEndToEnd(t *testing.T) {
wrp.EnsureTransactionUUID(),
wrp.ValidateOnlyUTF8Strings(),
),
pubsub.WithPublishTimeout(200*time.Millisecond),
)

require.NoError(err)
Expand Down
7 changes: 0 additions & 7 deletions internal/pubsub/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@ func New(self wrp.DeviceID, opts ...Option) (*PubSub, error) {
),
}

defaults := []Option{
WithPublishTimeout(5 * time.Second),
}

// Prepend the defaults to the provided options.
opts = append(defaults, opts...)

for _, opt := range opts {
if opt != nil {
if err := opt.apply(&ps); err != nil {
Expand Down

0 comments on commit 93bc3ae

Please sign in to comment.