Check queue length before pop

merge-requests/30/head
Bob Mottram 2024-11-06 14:03:30 +00:00
parent db0969ac80
commit 3f2bf8624d
2 changed files with 77 additions and 71 deletions

View File

@ -474,8 +474,10 @@ def replace_emoji_from_tags(session, base_dir: str,
if not tag_url:
continue
icon_name = tag_url.split('/')[-1]
if len(icon_name) > 1:
if icon_name[0].isdigit() and '.' in icon_name:
if len(icon_name) <= 1:
continue
if not (icon_name[0].isdigit() and '.' in icon_name):
continue
icon_name = icon_name.split('.')[0]
# see https://unicode.org/
# emoji/charts/full-emoji-list.html

View File

@ -2662,6 +2662,7 @@ def _inbox_quota_exceeded(queue: {}, queue_filename: str,
except OSError:
print('EX: _inbox_quota_exceeded unable to delete 1 ' +
str(queue_filename))
if len(queue) > 0:
queue.pop(0)
return True
quotas_daily['domains'][post_domain] += 1
@ -2684,6 +2685,7 @@ def _inbox_quota_exceeded(queue: {}, queue_filename: str,
except OSError:
print('EX: _inbox_quota_exceeded unable to delete 2 ' +
str(queue_filename))
if len(queue) > 0:
queue.pop(0)
return True
quotas_per_min['domains'][post_domain] += 1
@ -2705,6 +2707,7 @@ def _inbox_quota_exceeded(queue: {}, queue_filename: str,
except OSError:
print('EX: _inbox_quota_exceeded unable to delete 3 ' +
str(queue_filename))
if len(queue) > 0:
queue.pop(0)
return True
quotas_daily['accounts'][post_handle] += 1
@ -2727,6 +2730,7 @@ def _inbox_quota_exceeded(queue: {}, queue_filename: str,
except OSError:
print('EX: _inbox_quota_exceeded unable to delete 4 ' +
str(queue_filename))
if len(queue) > 0:
queue.pop(0)
return True
quotas_per_min['accounts'][post_handle] += 1