aboutsummaryrefslogtreecommitdiffstats
path: root/import_issues.py
diff options
context:
space:
mode:
Diffstat (limited to 'import_issues.py')
-rwxr-xr-ximport_issues.py35
1 files changed, 24 insertions, 11 deletions
diff --git a/import_issues.py b/import_issues.py
index 1b7c538..eee6ce6 100755
--- a/import_issues.py
+++ b/import_issues.py
@@ -145,6 +145,8 @@ logging.basicConfig(
ID_RE = re.compile(r"^[0-9]+$")
+tickets_to_be_closed = []
+
def get_labels(tracker: str) -> list[dict[str, str]]:
"""
@@ -386,17 +388,15 @@ def file_missing_ticket(
issue_count += 1
- # TODO Send these emails at the end, so that there isn't such a need for the
- # previous issue to be processed promptly.
- close_ticket(
- smtp=smtp,
- delay=delay,
- mode=mode,
- tracker=tracker,
- frm=frm,
- issue_id=issue_count,
- closed_at=None,
- is_closed=False, # Save one line of text.
+ tickets_to_be_closed.append(
+ (
+ smtp,
+ delay,
+ mode,
+ tracker,
+ frm,
+ issue_count,
+ )
)
@@ -742,6 +742,19 @@ def run(
is_closed=(issue_json["state"] == "closed"),
)
+ log.info("Delayed closing issues.")
+ for ticket in tickets_to_be_closed:
+ close_ticket(
+ smtp=ticket[0],
+ delay=ticket[1],
+ mode=ticket[2],
+ tracker=ticket[3],
+ frm=ticket[4],
+ issue_id=ticket[5],
+ closed_at=None,
+ is_closed=False,
+ )
+
def main():
parser = argparse.ArgumentParser(