aboutsummaryrefslogtreecommitdiffstats
path: root/edaweb/cache.py
blob: 86946663724bb7c82a12b44d63d9737b5643713e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import database
import services
import json

def update_cache():
    print("Updating cache...")
    with database.Database() as db:
        db.update_commit_cache(services.request_recent_commits(since = db.get_last_commit_time()))
        print("Finished adding github commits...")
        db.append_qnas(services.scrape_whispa(db.config.get("qnas", "url"), since = db.get_oldest_qna()))
        # print(json.dumps(services.scrape_whispa(db.config.get("qnas", "url"), since = db.get_oldest_qna()), indent = 4))
        print("Finished parsing Q&As...")

    print("Started getting docker information with SSH...")
    print(services.cache_all_docker_containers(services.CONFIG.get("ssh", "docker_key_path")))
    print("Finished caching.")


if __name__ == "__main__":
    update_cache()