Open alanshaw opened 3 weeks ago
if I'm not wrong, the potential issues can only come from the concurrent use of the underlying store. It's a common design to let the user of the type decide whether thread-safety is required, which will depend on the specific use case. I think it's ok to defer to the thread-safety of the store.
I put a PR up to clarify this in the comment of publisher.New
, but I think the code is good otherwise. This test setup in the publisher tests would be an example of how to build a thread-safe publisher: https://github.com/storacha/ipni-publisher/blob/feb09cf21fabca70dae7038e0d7fbc3728871554/pkg/publisher/publisher_test.go#L35-L37
I'll update the example too to reinforce the fact.
I don't see any locks in or around
NotifyPut
- what happens if this is called concurrently? Can I lose an advertisement or is there some clever mitigation that I'm missing?