From 543107a70eeffaa6932c87c02b43b0fd4f8558e5 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 3 Jan 2021 13:09:35 +0200 Subject: feat: load chunk metadata into index at startup This needs to be replace with a database or something, but it'll do for now. --- subplot/server.py | 3 ++- subplot/server.yaml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'subplot') diff --git a/subplot/server.py b/subplot/server.py index dca7f10..5cc9d9b 100644 --- a/subplot/server.py +++ b/subplot/server.py @@ -24,7 +24,8 @@ def start_chunk_server(ctx): shutil.copy(os.path.join(srcdir, x), x) chunks = "chunks" - os.mkdir(chunks) + if not os.path.exists(chunks): + os.mkdir(chunks) port = random.randint(2000, 30000) ctx["config"] = config = { diff --git a/subplot/server.yaml b/subplot/server.yaml index e7a72b2..2cc2b5f 100644 --- a/subplot/server.yaml +++ b/subplot/server.yaml @@ -2,6 +2,9 @@ function: start_chunk_server cleanup: stop_chunk_server +- when: "the chunk server is stopped" + function: stop_chunk_server + - when: "I POST (?P\\S+) to (?P\\S+), with (?P
\\S+): (?P.*)" regex: true function: post_file -- cgit v1.2.1