Skip to content

Commit 38791c8

Browse files
authored
Merge pull request #190 from Geode-solutions/fix/refactor_kill
fix(Kill): kill route
2 parents bc2a014 + e78037c commit 38791c8

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ __pycache__
99
.vscode
1010
uploads
1111
node_modules
12-
schemas.json
1312
.mypy_cache
1413
*.db
14+
opengeodeweb_back_schemas.json

package-lock.json

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,3 @@ werkzeug==3.1.2
6969
# flask
7070
# flask-cors
7171

72-
opengeodeweb-microservice~=1.0

src/opengeodeweb_back/routes/blueprint_routes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,3 +381,17 @@ def ping():
381381
utils_functions.validate_request(flask.request, ping_json)
382382
flask.current_app.config.update(LAST_PING_TIME=time.time())
383383
return flask.make_response({"message": "Flask server is running"}, 200)
384+
385+
386+
with open(
387+
os.path.join(schemas, "kill.json"),
388+
"r",
389+
) as file:
390+
kill_json = json.load(file)
391+
392+
393+
@routes.route(kill_json["route"], methods=kill_json["methods"])
394+
def kill() -> flask.Response:
395+
print("Manual server kill, shutting down...", flush=True)
396+
os._exit(0)
397+
return flask.make_response({"message": "Flask server is dead"}, 200)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"route": "/kill",
3+
"methods": [
4+
"POST"
5+
],
6+
"type": "object",
7+
"properties": {},
8+
"required": [],
9+
"additionalProperties": false
10+
}

0 commit comments

Comments
 (0)