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
Package registry
Container Registry
Model registry
Operate
Terraform modules
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
Timo Ley
synapse
Commits
5eac0b7e
Unverified
Commit
5eac0b7e
authored
4 years ago
by
Patrick Cloke
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add more types to synapse.storage.database. (#8127)
parent
731dfff3
No related branches found
No related tags found
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changelog.d/8127.misc
+1
-0
1 addition, 0 deletions
changelog.d/8127.misc
synapse/storage/database.py
+358
-219
358 additions, 219 deletions
synapse/storage/database.py
synapse/storage/databases/main/ui_auth.py
+8
-3
8 additions, 3 deletions
synapse/storage/databases/main/ui_auth.py
with
367 additions
and
222 deletions
changelog.d/8127.misc
0 → 100644
+
1
−
0
View file @
5eac0b7e
Add type hints to `synapse.storage.database`.
This diff is collapsed.
Click to expand it.
synapse/storage/database.py
+
358
−
219
View file @
5eac0b7e
This diff is collapsed.
Click to expand it.
synapse/storage/databases/main/ui_auth.py
+
8
−
3
View file @
5eac0b7e
...
...
@@ -19,6 +19,7 @@ from canonicaljson import json
from
synapse.api.errors
import
StoreError
from
synapse.storage._base
import
SQLBaseStore
,
db_to_json
from
synapse.storage.database
import
LoggingTransaction
from
synapse.types
import
JsonDict
from
synapse.util
import
stringutils
as
stringutils
...
...
@@ -214,14 +215,16 @@ class UIAuthWorkerStore(SQLBaseStore):
value
,
)
def
_set_ui_auth_session_data_txn
(
self
,
txn
,
session_id
:
str
,
key
:
str
,
value
:
Any
):
def
_set_ui_auth_session_data_txn
(
self
,
txn
:
LoggingTransaction
,
session_id
:
str
,
key
:
str
,
value
:
Any
):
# Get the current value.
result
=
self
.
db_pool
.
simple_select_one_txn
(
txn
,
table
=
"
ui_auth_sessions
"
,
keyvalues
=
{
"
session_id
"
:
session_id
},
retcols
=
(
"
serverdict
"
,),
)
)
# type: Dict[str, Any] # type: ignore
# Update it and add it back to the database.
serverdict
=
db_to_json
(
result
[
"
serverdict
"
])
...
...
@@ -275,7 +278,9 @@ class UIAuthStore(UIAuthWorkerStore):
expiration_time
,
)
def
_delete_old_ui_auth_sessions_txn
(
self
,
txn
,
expiration_time
:
int
):
def
_delete_old_ui_auth_sessions_txn
(
self
,
txn
:
LoggingTransaction
,
expiration_time
:
int
):
# Get the expired sessions.
sql
=
"
SELECT session_id FROM ui_auth_sessions WHERE creation_time <= ?
"
txn
.
execute
(
sql
,
[
expiration_time
])
...
...
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