File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
iroh-pkarr-naming-system/src
iroh-pkarr-node-discovery/src Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,8 @@ impl IPNS {
6464 let pkarr = self . 0 . pkarr . clone ( ) ;
6565 let signed_packet: SignedPacket = Self :: to_signed_packet ( & secret_key, & record, 0 ) ?;
6666 let publish_task = tokio:: spawn ( async move {
67+ tokio:: time:: sleep ( INITIAL_PUBLISH_DELAY ) . await ;
6768 loop {
68- tokio:: time:: sleep ( INITIAL_PUBLISH_DELAY ) . await ;
6969 let res = pkarr. publish ( & signed_packet) . await ;
7070 match res {
7171 Ok ( sqm) => {
@@ -75,7 +75,7 @@ impl IPNS {
7575 tracing:: warn!( "Failed to publish record: {}" , e) ;
7676 }
7777 }
78- tokio:: time:: sleep ( REPUBLISH_DELAY - INITIAL_PUBLISH_DELAY ) . await ;
78+ tokio:: time:: sleep ( REPUBLISH_DELAY ) . await ;
7979 }
8080 } ) ;
8181 let mut packets = self . 0 . packets . lock ( ) . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -175,10 +175,10 @@ impl PkarrNodeDiscovery {
175175 let z32 = pkarr:: PublicKey :: try_from ( * keypair. public ( ) . as_bytes ( ) )
176176 . expect ( "valid public key" )
177177 . to_z32 ( ) ;
178+ // initial delay. If the task gets aborted before this delay is over,
179+ // we have not published anything to the DHT yet.
180+ tokio:: time:: sleep ( INITIAL_PUBLISH_DELAY ) . await ;
178181 loop {
179- // initial delay. If the task gets aborted before this delay is over,
180- // we have not published anything to the DHT yet.
181- tokio:: time:: sleep ( INITIAL_PUBLISH_DELAY ) . await ;
182182 // publish to the DHT if enabled
183183 let dht_publish = async {
184184 if this. 0 . dht {
@@ -224,7 +224,7 @@ impl PkarrNodeDiscovery {
224224 } ;
225225 // do both at the same time
226226 tokio:: join!( relay_publish, dht_publish) ;
227- tokio:: time:: sleep ( REPUBLISH_DELAY - INITIAL_PUBLISH_DELAY ) . await ;
227+ tokio:: time:: sleep ( REPUBLISH_DELAY ) . await ;
228228 }
229229 }
230230
You can’t perform that action at this time.
0 commit comments