Update app.py
Browse files
app.py
CHANGED
|
@@ -291,7 +291,7 @@ def main():
|
|
| 291 |
"""Main function to process articles."""
|
| 292 |
logging.info("Starting scrape and rewrite process")
|
| 293 |
processed_count = 0
|
| 294 |
-
MAX_ARTICLES =
|
| 295 |
try:
|
| 296 |
rows = fetch_links()
|
| 297 |
logging.info(f"Found {len(rows)} links to process")
|
|
@@ -347,15 +347,18 @@ def main():
|
|
| 347 |
finally:
|
| 348 |
logging.info("Process ended")
|
| 349 |
|
| 350 |
-
|
|
|
|
| 351 |
def run_scheduler():
|
| 352 |
-
"""Run scheduler
|
| 353 |
-
|
| 354 |
-
|
|
|
|
|
|
|
| 355 |
|
| 356 |
while True:
|
| 357 |
schedule.run_pending()
|
| 358 |
-
time.sleep(60) #
|
| 359 |
|
| 360 |
# === GRADIO INTERFACE ===
|
| 361 |
def gradio_interface():
|
|
|
|
| 291 |
"""Main function to process articles."""
|
| 292 |
logging.info("Starting scrape and rewrite process")
|
| 293 |
processed_count = 0
|
| 294 |
+
MAX_ARTICLES = 35
|
| 295 |
try:
|
| 296 |
rows = fetch_links()
|
| 297 |
logging.info(f"Found {len(rows)} links to process")
|
|
|
|
| 347 |
finally:
|
| 348 |
logging.info("Process ended")
|
| 349 |
|
| 350 |
+
|
| 351 |
+
# === SCHEDULER ===
|
| 352 |
def run_scheduler():
|
| 353 |
+
"""Run scheduler untuk menjalankan main() pada pukul 00:00 WIB dan 12:00 WIB."""
|
| 354 |
+
# Asumsi server di UTC: 00:00 WIB = 17:00 UTC, 12:00 WIB = 05:00 UTC
|
| 355 |
+
schedule.every().day.at("17:00").do(main) # 00:00 WIB
|
| 356 |
+
schedule.every().day.at("05:00").do(main) # 12:00 WIB
|
| 357 |
+
logging.info("Scheduler started, waiting untuk 00:00 WIB dan 12:00 WIB")
|
| 358 |
|
| 359 |
while True:
|
| 360 |
schedule.run_pending()
|
| 361 |
+
time.sleep(60) # Cek setiap menit
|
| 362 |
|
| 363 |
# === GRADIO INTERFACE ===
|
| 364 |
def gradio_interface():
|