-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: reward user endpoint retry mechanism #325
Conversation
src/Persistence/Migrations/20240318113705_AddIdempotencyKeys.cs
Outdated
Show resolved
Hide resolved
src/Persistence/Migrations/20240318113705_AddIdempotencyKeys.cs
Outdated
Show resolved
Hide resolved
src/Persistence/Migrations/20240318113705_AddIdempotencyKeys.cs
Outdated
Show resolved
Hide resolved
|
||
namespace Crpg.Persistence.Migrations | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scoped namespace
|
||
#nullable disable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
Just passing by 👋 That can also be resolved by catching |
…into idempotency-check
private async Task<IdempotencyKey?> LoadIdempotencyKey(Guid key, CancellationToken cancellationToken) | ||
{ | ||
var idempotencyKey = await _db.IdempotencyKeys | ||
.Where(ik => ik.Key == key.ToString()) | ||
.FirstOrDefaultAsync(cancellationToken); | ||
|
||
return idempotencyKey; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to the main function. There is no reuse of this method. It just makes it harder to spot issues in the main method.
Can you also fix the multiple warnings you introduced? |
creates idempotencykey table with guid, created timestamp & status.
if key doesn't exist or status != completed, will retry the reward.
else returns no reward