Skip to content

Commit dfa51b8

Browse files
Merge pull request #92 from Geode-solutions/next
Next
2 parents 048a0ab + 492a34d commit dfa51b8

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# CHANGELOG
22

3+
## v5.1.0-rc.1 (2024-09-16)
4+
5+
### Feature
6+
7+
* feat(utils_functions): before & teardown requests function wrappers ([`63af3ae`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/63af3aedea522d02e33a80c8bd8f137a1bf66a17))
8+
9+
### Unknown
10+
11+
* Merge pull request #91 from Geode-solutions/feat/before_teardown_request
12+
13+
feat(utils_functions): before & teardown requests function wrappers ([`01d7877`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/01d78772e243255bbd5dc7061ff7caa7190d1c3d))
14+
15+
* Apply prepare changes ([`74bd569`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/74bd569d75f991ff9bfc91c7b648d1374f8d841e))
16+
17+
* ([`41db35c`](https://github.com/Geode-solutions/OpenGeodeWeb-Back/commit/41db35cab5bc1555bf8c46cca03e513fbabb4189))
18+
319
## v5.0.0 (2024-09-02)
420

521
### Unknown

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55

66
[project]
77
name = "OpenGeodeWeb-Back"
8-
version = "5.0.0"
8+
version = "5.1.0-rc.1"
99
dynamic = ["dependencies"]
1010
authors = [
1111
{ name="Geode-solutions", email="[email protected]" },

src/opengeodeweb_back/utils_functions.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ def update_last_request_time(current_app):
3333
current_app.config.update(LAST_REQUEST_TIME=LAST_REQUEST_TIME)
3434

3535

36+
def before_request(current_app):
37+
increment_request_counter(current_app)
38+
39+
40+
def teardown_request(current_app):
41+
decrement_request_counter(current_app)
42+
update_last_request_time(current_app)
43+
44+
3645
def kill_task(current_app):
3746
DESKTOP_APP = bool(current_app.config.get("DESKTOP_APP"))
3847
REQUEST_COUNTER = int(current_app.config.get("REQUEST_COUNTER"))

tests/test_utils_functions.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ def test_update_last_request_time(app_context):
2020
assert flask.current_app.config.get("LAST_REQUEST_TIME") >= LAST_REQUEST_TIME
2121

2222

23+
def test_before_request(app_context):
24+
assert flask.current_app.config.get("REQUEST_COUNTER") == 0
25+
utils_functions.before_request(flask.current_app)
26+
assert flask.current_app.config.get("REQUEST_COUNTER") == 1
27+
28+
29+
def test_teardown_request(app_context):
30+
LAST_REQUEST_TIME = flask.current_app.config.get("LAST_REQUEST_TIME")
31+
assert flask.current_app.config.get("REQUEST_COUNTER") == 1
32+
utils_functions.teardown_request(flask.current_app)
33+
assert flask.current_app.config.get("REQUEST_COUNTER") == 0
34+
assert flask.current_app.config.get("LAST_REQUEST_TIME") >= LAST_REQUEST_TIME
35+
36+
2337
def test_versions():
2438
list_packages = [
2539
"OpenGeode-core",

0 commit comments

Comments
 (0)