From fb818cd07243d6112fe9f47f040c4559cde80454 Mon Sep 17 00:00:00 2001 From: Eric House Date: Sat, 6 Jul 2019 11:06:35 -0700 Subject: [PATCH] don't assume send will succeed (Pulling in change that's been on eehouse.org for a while) --- xwords4/relay/scripts/fcm_loop.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xwords4/relay/scripts/fcm_loop.py b/xwords4/relay/scripts/fcm_loop.py index 5e0578e43..eb5fe3c39 100755 --- a/xwords4/relay/scripts/fcm_loop.py +++ b/xwords4/relay/scripts/fcm_loop.py @@ -267,10 +267,13 @@ def main(): while g_con: if g_debug: print + nSent = 0 devids = getPendingMsgs( g_con, typ ) + # print "got msgs:", len(devids) if 0 < len(devids): devids = addClntVers( g_con, devids ) targets = targetsAfterBackoff( devids ) + # print "got targets:", len(targets) if 0 < len(targets): if 0 < emptyCount: print "" emptyCount = 0 @@ -283,10 +286,12 @@ def main(): and 3 <= target['clntVers'] \ and target['msg64']: toDelete.append( str(target['id']) ) + nSent += 1 pruneSent( devids ) deleteMsgs( g_con, toDelete ) elif g_debug: print "no targets after backoff" - else: + + if nSent == 0: emptyCount += 1 if (0 == (emptyCount%5)) and not g_debug: sys.stdout.write('.')