Added retry logic to fetching process
This commit is contained in:
+12
-1
@@ -290,8 +290,19 @@ proc fetchiidb {url echos dbfile dolog maxids} {
|
|||||||
if {$dolog eq 1} {puts "Fetching $globalcount new messages from $echoname..."}
|
if {$dolog eq 1} {puts "Fetching $globalcount new messages from $echoname..."}
|
||||||
dict for {mgrpind mgrp} $idgroups { # iterate over groups to fetch the messages
|
dict for {mgrpind mgrp} $idgroups { # iterate over groups to fetch the messages
|
||||||
# get the message data in the bundle format
|
# get the message data in the bundle format
|
||||||
|
set plen 0
|
||||||
|
set retries 4
|
||||||
|
while {$plen < $globalcount} {
|
||||||
set msgbundle [getfile [string cat $url "/u/m/" [join $mgrp "/"]]]
|
set msgbundle [getfile [string cat $url "/u/m/" [join $mgrp "/"]]]
|
||||||
set bdata [split $msgbundle "\n"]
|
set bdata [lmap m [split $msgbundle "\n"] {
|
||||||
|
set m [string trim $m]
|
||||||
|
if {$m eq ""} {continue}
|
||||||
|
set m
|
||||||
|
}]
|
||||||
|
set plen [llength $bdata]
|
||||||
|
incr retries -1
|
||||||
|
if {$retries < 1} {break}
|
||||||
|
}
|
||||||
foreach bline $bdata {
|
foreach bline $bdata {
|
||||||
set parts [split $bline ":"]
|
set parts [split $bline ":"]
|
||||||
if {[llength $parts] > 1} { # valid message
|
if {[llength $parts] > 1} { # valid message
|
||||||
|
|||||||
Reference in New Issue
Block a user