Skip to content

Commit 71b9960

Browse files
Merge pull request #381 from OP-TED/hotfix/TED-1016
Hotfix/ted 1016
2 parents bcf0c0d + b7c1900 commit 71b9960

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

ted_sws/data_manager/adapters/notice_repository.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ def __init__(self, mongodb_client: MongoClient, database_name: str = None):
130130
self._database_name = database_name
131131
self.mongodb_client = mongodb_client
132132
notice_db = mongodb_client[self._database_name]
133-
self.file_storage = gridfs.GridFS(notice_db)
133+
self.file_storage = gridfs.GridFS(notice_db) # TODO: Investigate how it works in multiple processes in parallel.
134134
self.collection = notice_db[self._collection_name]
135-
self.collection.create_index([(NOTICE_CREATED_AT, ASCENDING)])
136-
self.collection.create_index([(NOTICE_STATUS, ASCENDING)])
135+
self.collection.create_index([(NOTICE_CREATED_AT, ASCENDING)]) # TODO: index creation may bring race condition error.
136+
self.collection.create_index([(NOTICE_STATUS, ASCENDING)]) # TODO: index creation may bring race condition error.
137137
self.file_storage_collection = notice_db[FILE_STORAGE_COLLECTION_NAME]
138-
self.file_storage_collection.create_index([(NOTICE_ID, ASCENDING)])
138+
self.file_storage_collection.create_index([(NOTICE_ID, ASCENDING)]) # TODO: index creation may bring race condition error.
139139

140140
def get_file_content_from_grid_fs(self, file_id: str) -> str:
141141
"""

ted_sws/data_manager/adapters/supra_notice_repository.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self, mongodb_client: MongoClient, database_name: str = None):
2222
self.mongodb_client = mongodb_client
2323
daily_supra_notice_db = mongodb_client[self._database_name]
2424
self.collection = daily_supra_notice_db[self._collection_name]
25-
self.collection.create_index([(DAILY_SUPRA_NOTICE_ID, ASCENDING)])
25+
self.collection.create_index([(DAILY_SUPRA_NOTICE_ID, ASCENDING)]) # TODO: index creation may bring race condition error.
2626

2727
def _update_daily_supra_notice(self, daily_supra_notice: DailySupraNotice, upsert: bool = False):
2828
daily_supra_notice_dict = daily_supra_notice.dict()

ted_sws/event_manager/adapters/event_logging_repository.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@ def create_indexes(self):
5858
5959
:return: None
6060
"""
61-
self.collection.create_index([("year", DESCENDING)])
62-
self.collection.create_index([("month", ASCENDING)])
63-
self.collection.create_index([("day", ASCENDING)])
64-
self.collection.create_index([("caller_name", ASCENDING)])
61+
try: # FIXME: This is temporary solution for exclude race condition error
62+
self.collection.create_index([("year", DESCENDING)]) # TODO: index creation may bring race condition error.
63+
self.collection.create_index([("month", ASCENDING)]) # TODO: index creation may bring race condition error.
64+
self.collection.create_index([("day", ASCENDING)]) # TODO: index creation may bring race condition error.
65+
self.collection.create_index([("caller_name", ASCENDING)]) # TODO: index creation may bring race condition error.
66+
except:
67+
pass
6568

6669
@classmethod
6770
def prepare_record(cls, event_message: EventMessage) -> dict:

0 commit comments

Comments
 (0)