Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend_api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
videoag
backend_api
Commits
35640131
Commit
35640131
authored
5 months ago
by
Simon Künzel
Browse files
Options
Downloads
Patches
Plain Diff
Fix announcement query error handling
parent
db2e2330
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/api/routes/site.py
+7
-4
7 additions, 4 deletions
src/api/routes/site.py
with
7 additions
and
4 deletions
src/api/routes/site.py
+
7
−
4
View file @
35640131
...
@@ -32,15 +32,18 @@ def api_route_status():
...
@@ -32,15 +32,18 @@ def api_route_status():
if
api
.
live_config
.
is_readonly
():
if
api
.
live_config
.
is_readonly
():
status
=
"
readonly
"
status
=
"
readonly
"
# noinspection PyBroadException
# noinspection PyBroadException
query
=
Announcement
.
select
(
is_mod
,
to_load
=
[])
db_rows
=
[]
try
:
try
:
announcements
.
extend
(
map
(
db_rows
=
database
.
query_all_and_expunge
(
query
)
lambda
a
:
a
.
serialize
(
is_mod
=
is_mod
),
database
.
query_all_and_expunge
(
Announcement
.
select
(
is_mod
,
to_load
=
[]))
))
except
Exception
:
except
Exception
:
# We do NOT return status 'unavailable' because the status is the EXPECTED status. If there is an unexpected
# We do NOT return status 'unavailable' because the status is the EXPECTED status. If there is an unexpected
# db failure, we want errors to show up and not just 'Site not available'
# db failure, we want errors to show up and not just 'Site not available'
pass
pass
announcements
.
extend
(
map
(
lambda
a
:
a
.
serialize
(
is_mod
=
is_mod
),
db_rows
))
response
=
{
response
=
{
"
status
"
:
status
,
"
status
"
:
status
,
"
is_debug
"
:
DEBUG_ENABLED
,
"
is_debug
"
:
DEBUG_ENABLED
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment