libp2p / go-libp2p-pubsub

The PubSub implementation for go-libp2p
https://github.com/libp2p/specs/tree/master/pubsub
Other
323 stars 187 forks source link

Republish fails even after timecache expiry #467

Closed kostko closed 1 year ago

kostko commented 2 years ago

It seems that currently republishing a duplicate message fails even after the timecache entry should have expired if that is the only message being (re)published. This is due to the sweep method only being called after Add which is only ever called when a new message is added in markSeen.

If we have a simple example where there is only a single message being republished, the sweep will never happen and thus the old message ID will be left stale in the timecache, preventing publication.

The timecache should either be swept periodically or before Has (see related issue https://github.com/whyrusleeping/timecache/issues/2).

kostko commented 1 year ago

This has been fixed in the new in-tree timecache implementation by using a background goroutine that periodically sweeps.