Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
facebook
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
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
mautrix
facebook
Commits
ee6d673c
Commit
ee6d673c
authored
4 years ago
by
Tulir Asokan
Browse files
Options
Downloads
Patches
Plain Diff
Prevent re-syncing threads multiple times in a short time
parent
17dec9c4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mautrix_facebook/user.py
+6
-0
6 additions, 0 deletions
mautrix_facebook/user.py
with
6 additions
and
0 deletions
mautrix_facebook/user.py
+
6
−
0
View file @
ee6d673c
...
...
@@ -53,6 +53,7 @@ class User(BaseUser):
_is_logged_in
:
Optional
[
bool
]
_is_connected
:
Optional
[
bool
]
_connection_time
:
float
_prev_thread_sync
:
float
_session_data
:
Optional
[
Dict
[
str
,
str
]]
_db_instance
:
Optional
[
DBUser
]
_sync_lock
:
SimpleLock
...
...
@@ -72,6 +73,7 @@ class User(BaseUser):
self
.
_is_logged_in
=
None
self
.
_is_connected
=
None
self
.
_connection_time
=
time
.
monotonic
()
self
.
_prev_thread_sync
=
-
10
self
.
_session_data
=
session
self
.
_db_instance
=
db_instance
self
.
_community_id
=
None
...
...
@@ -312,6 +314,10 @@ class User(BaseUser):
self
.
log
.
exception
(
"
Failed to sync contacts
"
)
async
def
sync_threads
(
self
)
->
None
:
if
self
.
_prev_thread_sync
+
10
>
time
.
monotonic
():
self
.
log
.
debug
(
"
Previous thread sync was less than 10 seconds ago, not re-syncing
"
)
return
self
.
_prev_thread_sync
=
time
.
monotonic
()
try
:
sync_count
=
config
[
"
bridge.initial_chat_sync
"
]
if
sync_count
<=
0
:
...
...
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