Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
ff1fa0fb
Commit
ff1fa0fb
authored
10 years ago
by
Paul "LeoNerd" Evans
Browse files
Options
Downloads
Patches
Plain Diff
Add another @cached wrapper, this time on get_presence_state()
parent
abcd03af
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/storage/presence.py
+8
-2
8 additions, 2 deletions
synapse/storage/presence.py
with
8 additions
and
2 deletions
synapse/storage/presence.py
+
8
−
2
View file @
ff1fa0fb
...
...
@@ -13,7 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
._base
import
SQLBaseStore
from
twisted.internet
import
defer
from
._base
import
SQLBaseStore
,
cached
class
PresenceStore
(
SQLBaseStore
):
...
...
@@ -33,6 +35,7 @@ class PresenceStore(SQLBaseStore):
desc
=
"
has_presence_state
"
,
)
@cached
()
def
get_presence_state
(
self
,
user_localpart
):
return
self
.
_simple_select_one
(
table
=
"
presence
"
,
...
...
@@ -41,8 +44,9 @@ class PresenceStore(SQLBaseStore):
desc
=
"
get_presence_state
"
,
)
@defer.inlineCallbacks
def
set_presence_state
(
self
,
user_localpart
,
new_state
):
ret
urn
self
.
_simple_update_one
(
ret
=
yield
self
.
_simple_update_one
(
table
=
"
presence
"
,
keyvalues
=
{
"
user_id
"
:
user_localpart
},
updatevalues
=
{
"
state
"
:
new_state
[
"
state
"
],
...
...
@@ -50,6 +54,8 @@ class PresenceStore(SQLBaseStore):
"
mtime
"
:
self
.
_clock
.
time_msec
()},
desc
=
"
set_presence_state
"
,
)
self
.
get_presence_state
.
invalidate
(
user_localpart
)
defer
.
returnValue
(
ret
)
def
allow_presence_visible
(
self
,
observed_localpart
,
observer_userid
):
return
self
.
_simple_insert
(
...
...
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