#30 If failing to process a repo, wait 30 seconds and try again
Merged 8 years ago by pingou. Opened 8 years ago by pingou.

file modified
+18 -4
@@ -41,6 +41,7 @@ 

  import os

  import shutil

  import tempfile

+ import time

  import hashlib

  import xml.etree.ElementTree as ET

  
@@ -504,11 +505,24 @@ 

      #)

  

      # In serial

+     sleep_for = CONFIG.get('CRON_SLEEP', 30)

      for t in itertools.product(

-         [CONFIG.get('DB_FOLDER', '/var/tmp')],

-         repositories):

- 

-         process_repo(t)

+             [CONFIG.get('DB_FOLDER', '/var/tmp')],

+             repositories):

+ 

+         loop = True

+         cnt = 0

+         while loop:

+             cnt += 1

+             try:

+                 process_repo(t)

+                 loop = False

+             except OSError:

+                 if cnt == 4:

+                     raise

+                 # Most often due to an invalid stream, so let's try a second time

+                 time.sleep(sleep_for)

+                 process_repo(t)

  

      return 0

  

no initial comment

Pull-Request has been rebased

8 years ago

I think this might be a bit long, not?

If the problem is that koji is currently writing/generating its sqlite DB, I don't think it's too much.

The cron runs every 20 minutes, so it should be fine anyway

Heh, can we make the sleep interval configurable?

Pull-Request has been updated

8 years ago

Maybe instead of retry once, have a retry counter, sleep for sleep_for between every attempt, and only abort if it still doesn't work after retry_for times?

Pull-Request has been updated

8 years ago

thanks, closing then :)

Pull-Request has been merged by pingou

8 years ago
Metadata