dbpedia / ontology-time-machine

5 stars 2 forks source link

create fix and add test for archivo sync mode to fetch correctly version update from databus #93

Open JJ-Author opened 1 month ago

JJ-Author commented 1 month ago

at the moment download function uses a static version

https://github.com/kuefmz/ontology-time-machine/commit/5a4c00a91cd3a60aa67cce9052e583aaf3d87bed#diff-8ff9d079ad7f2b51ed3c75fb7cccb753ce68f6d0e9fdac46a7e4cbf0003da73dR17

we need to retrieve the latest version via issueing a sparql query to determine the file link of the most recent file. then we can proceed.

open question is also whether the while loop is the way to go. copilot says its common but usually there is an asyncio for it. Dunno for sure but in the end the sleep should not block other parts of the code.

import asyncio
import schedule

def job():
    print("Task is running...")

# Schedule the job every 10 seconds
schedule.every(10).seconds.do(job)

async def run_scheduler():
    while True:
        schedule.run_pending()
        await asyncio.sleep(60)

async def main():
    await run_scheduler()

if __name__ == "__main__":
    asyncio.run(main())