This repository was archived by the owner on Oct 2, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed
Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 1313
1414
1515def dsa_list ():
16- req = requests .get ('https://www.debian.org/security/dsa-long' )
16+ req = requests .get ('https://www.debian.org/security/dsa-long' , timeout = 30 )
1717 req .raise_for_status ()
1818
1919 root = ElementTree .fromstring (req .content )
Original file line number Diff line number Diff line change 77from ircbot .plugin import debian_security
88
99# Check for Debian security announcements every 5 minutes
10- # If a check fails, we bump add another 5 minutes, until
11- # the maximum of 30 minutes
10+ # If a check fails, we bump add another 10 minutes, until
11+ # the maximum of 120 minutes
1212DSA_FREQ_DEFAULT = 5
13- DSA_FREQ_BACKOFF = 5
14- DSA_FREQ_MAX = 30
13+ DSA_FREQ_BACKOFF = 10
14+ DSA_FREQ_MAX = 120
1515
1616
1717def register (bot ):
1818 bot .add_thread (timer )
1919
2020
2121def timer (bot ):
22+ exception_count = 0
2223 dsa_freq = DSA_FREQ_DEFAULT
2324
2425 last_date = None
@@ -39,11 +40,15 @@ def timer(bot):
3940 for line in debian_security .get_new_dsas ():
4041 bot .say ('#rebuild' , line )
4142
43+ # After a successful fetch, reset the exception count
44+ exception_count = 0
4245 # After a successful fetch, we reset timer to 5m
4346 dsa_freq = DSA_FREQ_DEFAULT
4447 except Exception as ex :
45- error_msg = f'ircbot exception in timer: { ex } '
46- bot .say ('#rebuild' , error_msg )
48+ exception_count += 1
49+ error_msg = f'ircbot exception in timer: { ex } , this error occurred { exception_count } times.'
50+ if exception_count > 9 :
51+ bot .say ('#rebuild' , error_msg )
4752 bot .handle_error (
4853 dedent (
4954 """
You can’t perform that action at this time.
0 commit comments