Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
dc6fb56c
"src/git@mau.dev:june/conduwuit.git" did not exist on "51aa6448bcb79892b15acceba5299caa3c3f17c9"
Unverified
Commit
dc6fb56c
authored
5 years ago
by
Brendan Abolivier
Browse files
Options
Downloads
Patches
Plain Diff
Hopefully mypy is happy now
parent
fe593ef9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/logging/context.py
+2
-1
2 additions, 1 deletion
synapse/logging/context.py
synapse/storage/database.py
+8
-2
8 additions, 2 deletions
synapse/storage/database.py
with
10 additions
and
3 deletions
synapse/logging/context.py
+
2
−
1
View file @
dc6fb56c
...
@@ -210,7 +210,7 @@ class LoggingContext(object):
...
@@ -210,7 +210,7 @@ class LoggingContext(object):
class
Sentinel
(
object
):
class
Sentinel
(
object
):
"""
Sentinel to represent the root context
"""
"""
Sentinel to represent the root context
"""
__slots__
=
[
"
previous_context
"
,
"
alive
"
,
"
request
"
,
"
scope
"
]
__slots__
=
[
"
previous_context
"
,
"
alive
"
,
"
request
"
,
"
scope
"
,
"
tag
"
]
def
__init__
(
self
)
->
None
:
def
__init__
(
self
)
->
None
:
# Minimal set for compatibility with LoggingContext
# Minimal set for compatibility with LoggingContext
...
@@ -218,6 +218,7 @@ class LoggingContext(object):
...
@@ -218,6 +218,7 @@ class LoggingContext(object):
self
.
alive
=
None
self
.
alive
=
None
self
.
request
=
None
self
.
request
=
None
self
.
scope
=
None
self
.
scope
=
None
self
.
tag
=
None
def
__str__
(
self
):
def
__str__
(
self
):
return
"
sentinel
"
return
"
sentinel
"
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/database.py
+
8
−
2
View file @
dc6fb56c
...
@@ -29,7 +29,11 @@ from twisted.internet import defer
...
@@ -29,7 +29,11 @@ from twisted.internet import defer
from
synapse.api.errors
import
StoreError
from
synapse.api.errors
import
StoreError
from
synapse.config.database
import
DatabaseConnectionConfig
from
synapse.config.database
import
DatabaseConnectionConfig
from
synapse.logging.context
import
LoggingContext
,
make_deferred_yieldable
from
synapse.logging.context
import
(
LoggingContext
,
LoggingContextOrSentinel
,
make_deferred_yieldable
,
)
from
synapse.metrics.background_process_metrics
import
run_as_background_process
from
synapse.metrics.background_process_metrics
import
run_as_background_process
from
synapse.storage.background_updates
import
BackgroundUpdater
from
synapse.storage.background_updates
import
BackgroundUpdater
from
synapse.storage.engines
import
BaseDatabaseEngine
,
PostgresEngine
,
Sqlite3Engine
from
synapse.storage.engines
import
BaseDatabaseEngine
,
PostgresEngine
,
Sqlite3Engine
...
@@ -543,7 +547,9 @@ class Database(object):
...
@@ -543,7 +547,9 @@ class Database(object):
Returns:
Returns:
Deferred: The result of func
Deferred: The result of func
"""
"""
parent_context
=
LoggingContext
.
current_context
()
parent_context
=
(
LoggingContext
.
current_context
()
)
# type: Optional[LoggingContextOrSentinel]
if
parent_context
==
LoggingContext
.
sentinel
:
if
parent_context
==
LoggingContext
.
sentinel
:
logger
.
warning
(
logger
.
warning
(
"
Starting db connection from sentinel context: metrics will be lost
"
"
Starting db connection from sentinel context: metrics will be lost
"
...
...
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