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

fix: correct consumers handling when custom_id is used #986

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

GGabriele
Copy link
Collaborator

Right now, when a consumer has the username equal to the custom_id of another consumer, decK fails because of the way the consumers are handled in the internal in-memory DB.

_format_version: "3.0"
consumers:
- custom_id: foo
  id: ce49186d-7670-445d-a218-897631b29ada
  username: Foo
- custom_id: bar
  id: 7820f383-7b77-4fcc-af7f-14ff3e256693
  username: foo
$ deck sync
Error: inserting consumer into state: inserting consumer Foo: entity already exists

This commit fixes this defect by modifying the way consumers are looked up in the in-memory DB.

@GGabriele GGabriele requested a review from a team as a code owner July 27, 2023 09:36
@GGabriele GGabriele force-pushed the fix/consumers-username-custom_id branch from 2b81957 to 5743626 Compare July 27, 2023 09:55
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 40.00% and project coverage change: -0.04% ⚠️

Comparison is base (24ef372) 33.71% compared to head (5743626) 33.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #986      +/-   ##
==========================================
- Coverage   33.71%   33.68%   -0.04%     
==========================================
  Files         100      100              
  Lines       12006    12018      +12     
==========================================
  Hits         4048     4048              
- Misses       7564     7574      +10     
- Partials      394      396       +2     
Files Changed Coverage Δ
file/writer.go 14.53% <0.00%> (ø)
state/builder.go 0.00% <0.00%> (ø)
file/builder.go 48.29% <33.33%> (ø)
state/consumer.go 71.79% <45.00%> (-8.21%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Right now, when a consumer has the `username` equal to the
`custom_id` of another consumer, decK fails because of the
way the consumers are handled in the internal in-memory DB.

```
_format_version: "3.0"
consumers:
- custom_id: foo
  id: ce49186d-7670-445d-a218-897631b29ada
  username: Foo
- custom_id: bar
  id: 7820f383-7b77-4fcc-af7f-14ff3e256693
  username: foo
```

```
$ deck sync
Error: inserting consumer into state: inserting consumer Foo: entity already exists
```

This commit fixes this defect by modifying the way consumers are
looked up in the in-memory DB.
@GGabriele GGabriele force-pushed the fix/consumers-username-custom_id branch from 5743626 to 32073a1 Compare July 27, 2023 11:32
Copy link

@teb510 teb510 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looked at the code - didn't have time to test today but lgtm (for whatever that's worth!).

Copy link
Member

@Tieske Tieske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@GGabriele GGabriele merged commit 6342b2b into main Jul 28, 2023
35 checks passed
@GGabriele GGabriele deleted the fix/consumers-username-custom_id branch July 28, 2023 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants