| @@ -95,6 +95,9 @@ class DRNClerkBot(Task): | |||||
| self.conn_data = kwargs | self.conn_data = kwargs | ||||
| self.db_access_lock = RLock() | self.db_access_lock = RLock() | ||||
| # Minimum size a MySQL TIMESTAMP field can hold: | |||||
| self.min_ts = datetime(1970, 1, 1, 0, 0, 1) | |||||
| def run(self, **kwargs): | def run(self, **kwargs): | ||||
| """Entry point for a task event.""" | """Entry point for a task event.""" | ||||
| if not self.db_access_lock.acquire(False): # Non-blocking | if not self.db_access_lock.acquire(False): # Non-blocking | ||||
| @@ -203,10 +206,9 @@ class DRNClerkBot(Task): | |||||
| f_time = datetime.strptime(match.group(2), strp) | f_time = datetime.strptime(match.group(2), strp) | ||||
| else: | else: | ||||
| f_user, f_time = None, datetime.utcnow() | f_user, f_time = None, datetime.utcnow() | ||||
| zero = datetime.min | |||||
| case = _Case(id_, title, status, self.STATUS_UNKNOWN, f_user, | case = _Case(id_, title, status, self.STATUS_UNKNOWN, f_user, | ||||
| f_time, "", zero, "", zero, zero, False, False, 0, | |||||
| new=True) | |||||
| f_time, "", self.min_ts, "", self.min_ts, | |||||
| self.min_ts, False, False, 0, new=True) | |||||
| cases.append(case) | cases.append(case) | ||||
| else: | else: | ||||
| case.status = status | case.status = status | ||||
| @@ -328,7 +330,7 @@ class DRNClerkBot(Task): | |||||
| return [] | return [] | ||||
| def clerk_closed_case(self, case, signatures): | def clerk_closed_case(self, case, signatures): | ||||
| if case.close_time == datetime.min: | |||||
| if case.close_time == self.min_ts: | |||||
| case.close_time = datetime.utcnow() | case.close_time = datetime.utcnow() | ||||
| timestamps = [timestamp for (editor, timestamp) in signatures] | timestamps = [timestamp for (editor, timestamp) in signatures] | ||||
| closed_age = (datetime.utcnow() - case.close_time).total_seconds() | closed_age = (datetime.utcnow() - case.close_time).total_seconds() | ||||
| @@ -356,6 +358,8 @@ class DRNClerkBot(Task): | |||||
| signatures = [] | signatures = [] | ||||
| for userlink, stamp in matches: | for userlink, stamp in matches: | ||||
| username = userlink.split("/", 1)[0].replace("_", " ").strip() | username = userlink.split("/", 1)[0].replace("_", " ").strip() | ||||
| if username == "DoNotArchiveUntil": | |||||
| continue | |||||
| stamp = stamp.strip() | stamp = stamp.strip() | ||||
| timestamp = datetime.strptime(stamp, "%H:%M, %d %B %Y (UTC)") | timestamp = datetime.strptime(stamp, "%H:%M, %d %B %Y (UTC)") | ||||
| signatures.append((username, timestamp)) | signatures.append((username, timestamp)) | ||||