Skip to content

Commit 304b7a1

Browse files
authored
Merge pull request #7 from mongodb-partners/new_listening
Corrected variable loading threshold time
2 parents b04c281 + 0d8eccc commit 304b7a1

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

listening.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,13 @@
2626
import schema_utils
2727
from file_utils import FileType, read_from_file, write_to_file
2828

29-
30-
# MAX_ROWS = 1
31-
# Time is an env variable now
32-
#TIME_THRESHOLD_IN_SEC = 300
33-
time_threshold_in_sec = float(os.getenv("TIME_THRESHOLD_IN_SEC"))
34-
#print(f"The type of time_threshold_in_sec is: {type(time_threshold_in_sec)}")
35-
3629
def listening(collection_name: str):
3730
logger = logging.getLogger(f"{__name__}[{collection_name}]")
3831
db_name = os.getenv("MONGO_DB_NAME")
3932
logger.debug(f"db_name={db_name}")
4033
logger.debug(f"collection={collection_name}")
34+
# moved listening method so that it is called after the env variables are loaded
35+
time_threshold_in_sec = float(os.getenv("TIME_THRESHOLD_IN_SEC"))
4136
post_init_flush_done = False
4237

4338
table_dir = get_table_dir(collection_name)

mongodb_generic_mirroring.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def mirror():
4343
or not os.getenv("TENANT_ID")
4444
or not os.getenv("INIT_LOAD_BATCH_SIZE")
4545
or not os.getenv("DELTA_SYNC_BATCH_SIZE")
46+
# added threshold time
47+
or not os.getenv("TIME_THRESHOLD_IN_SEC")
4648
):
4749
raise ValueError("Missing environment variable.")
4850

0 commit comments

Comments
 (0)