Skip to content

Commit 2905ecb

Browse files
committed
Fixing time sleeping
1 parent 8306751 commit 2905ecb

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

datapath.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def send_news_to_telegram(message):
4343
if __name__ == "__main__":
4444
data_from_db = news_db.create_connection(news_db.DB_FILE)
4545
while True:
46+
time.sleep(1)
4647
current_time = datetime.now().strftime("%H:%M")
4748
if TIME_TO_SEND_START < current_time < TIME_TO_SEND_END:
4849
logging.info(f"Time: {current_time}. Time to send has come !")

docker-compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: '3'
33
services:
44
news_db:
55
container_name: news_db
6-
image: h0d0user/news_db:v0.0.45
6+
image: h0d0user/news_db:v0.0.49
77
restart: always
88
network_mode: host
99
volumes:
@@ -12,7 +12,7 @@ services:
1212

1313
truth_seeker:
1414
container_name: truth_seeker
15-
image: h0d0user/truth_seeker:v0.0.45
15+
image: h0d0user/truth_seeker:v0.0.49
1616
restart: always
1717
network_mode: host
1818
depends_on:
@@ -23,7 +23,7 @@ services:
2323

2424
datapath:
2525
container_name: datapath
26-
image: h0d0user/datapath:v0.0.45
26+
image: h0d0user/datapath:v0.0.49
2727
restart: always
2828
network_mode: host
2929
depends_on:

news_db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ def delete_all_news(conn):
118118
create_table(conn, CREATE_TABLE_SQL)
119119

120120
while True:
121-
time.sleep(1)
122121
CURRENT_TIME = datetime.now().strftime("%H:%M")
122+
time.sleep(1)
123123
if conn is not None:
124124
send_all_news(conn)
125125
if CURRENT_TIME == TIME_TO_PURGE:

truth_seeker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
newsapi = NewsApiClient(api_key=API_KEY)
1717

18-
TIME_TO_SEARCH = "14:10"
18+
TIME_TO_SEARCH = "11:10"
1919

2020

2121
# Logging
@@ -69,8 +69,8 @@ def load_to_db(fetch_info: dict):
6969

7070
if __name__ == "__main__":
7171
while True:
72-
time.sleep(1)
7372
CURRENT_TIME = datetime.now().strftime("%H:%M")
73+
time.sleep(1)
7474
# Pull too much info
7575
if CURRENT_TIME == TIME_TO_SEARCH:
7676
logging.info(f"Time: {CURRENT_TIME}. Time to search has come !")

0 commit comments

Comments
 (0)