-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: allow skipping publish of existing advert #117
Conversation
Codecov ReportAttention: Patch coverage is
|
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.
left a couple nitpicks, but looks good
@@ -36,6 +38,7 @@ type ProviderIndexService struct { | |||
findClient ipnifind.Finder | |||
publisher publisher.Publisher | |||
legacyClaims LegacyClaimsFinder | |||
mutex *sync.Mutex |
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.
I'd use a plain sync.Mutex
here rather than the pointer.
@@ -46,6 +49,7 @@ func New(providerStore types.ProviderStore, findClient ipnifind.Finder, publishe | |||
findClient: findClient, | |||
publisher: publisher, | |||
legacyClaims: legacyClaims, | |||
mutex: &sync.Mutex{}, |
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.
and skip its initialization as the default value already provides a usable mutex
Co-authored-by: Vicente Olmedo <vicente@storacha.network>
If one or multiple users upload the same blob multiple times the
assert/index
invocation will create an advert that already exists. This will causeipni-publisher
to returnErrAlreadyAdvertised
and the invocation fails. This PR ignoresErrAlreadyAdvertised
because, that's fine, whatever.It also adds a mutex around publish per storacha/ipni-publisher#3