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
70c3d75a
Commit
70c3d75a
authored
4 years ago
by
Tulir Asokan
Browse files
Options
Downloads
Patches
Plain Diff
Suppress connection closed message when refreshing
parent
c043d422
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mautrix_facebook/user.py
+7
-1
7 additions, 1 deletion
mautrix_facebook/user.py
with
7 additions
and
1 deletion
mautrix_facebook/user.py
+
7
−
1
View file @
70c3d75a
...
@@ -59,6 +59,7 @@ class User(BaseUser):
...
@@ -59,6 +59,7 @@ class User(BaseUser):
_session_data
:
Optional
[
Dict
[
str
,
str
]]
_session_data
:
Optional
[
Dict
[
str
,
str
]]
_db_instance
:
Optional
[
DBUser
]
_db_instance
:
Optional
[
DBUser
]
_sync_lock
:
SimpleLock
_sync_lock
:
SimpleLock
_is_refreshing
:
bool
_community_helper
:
CommunityHelper
_community_helper
:
CommunityHelper
_community_id
:
Optional
[
CommunityID
]
_community_id
:
Optional
[
CommunityID
]
...
@@ -85,6 +86,7 @@ class User(BaseUser):
...
@@ -85,6 +86,7 @@ class User(BaseUser):
self
.
_community_id
=
None
self
.
_community_id
=
None
self
.
_sync_lock
=
SimpleLock
(
"
Waiting for thread sync to finish before handling %s
"
,
self
.
_sync_lock
=
SimpleLock
(
"
Waiting for thread sync to finish before handling %s
"
,
log
=
self
.
log
,
loop
=
self
.
loop
)
log
=
self
.
log
,
loop
=
self
.
loop
)
self
.
_is_refreshing
=
False
self
.
log
=
self
.
log
.
getChild
(
self
.
mxid
)
self
.
log
=
self
.
log
.
getChild
(
self
.
mxid
)
...
@@ -229,6 +231,7 @@ class User(BaseUser):
...
@@ -229,6 +231,7 @@ class User(BaseUser):
async
def
refresh
(
self
)
->
None
:
async
def
refresh
(
self
)
->
None
:
event_id
=
None
event_id
=
None
self
.
_is_refreshing
=
True
if
self
.
listener
:
if
self
.
listener
:
event_id
=
await
self
.
send_bridge_notice
(
"
Disconnecting Messenger MQTT connection
"
event_id
=
await
self
.
send_bridge_notice
(
"
Disconnecting Messenger MQTT connection
"
"
for session refresh...
"
)
"
for session refresh...
"
)
...
@@ -251,6 +254,8 @@ class User(BaseUser):
...
@@ -251,6 +254,8 @@ class User(BaseUser):
else
:
else
:
await
self
.
send_bridge_notice
(
"
Failed to refresh Messenger session:
"
await
self
.
send_bridge_notice
(
"
Failed to refresh Messenger session:
"
"
not logged in
"
,
edit
=
event_id
)
"
not logged in
"
,
edit
=
event_id
)
finally
:
self
.
_is_refreshing
=
False
async
def
logout
(
self
)
->
bool
:
async
def
logout
(
self
)
->
bool
:
ok
=
True
ok
=
True
...
@@ -473,7 +478,8 @@ class User(BaseUser):
...
@@ -473,7 +478,8 @@ class User(BaseUser):
async
for
event
in
self
.
listener
.
listen
():
async
for
event
in
self
.
listener
.
listen
():
await
self
.
_handle_event
(
event
)
await
self
.
_handle_event
(
event
)
self
.
is_connected
=
False
self
.
is_connected
=
False
await
self
.
send_bridge_notice
(
"
Facebook Messenger connection closed without error
"
)
if
not
self
.
_is_refreshing
:
await
self
.
send_bridge_notice
(
"
Facebook Messenger connection closed without error
"
)
async
def
_handle_event
(
self
,
event
:
Any
)
->
None
:
async
def
_handle_event
(
self
,
event
:
Any
)
->
None
:
self
.
log
.
debug
(
"
Handling facebook event of type %s
"
,
type
(
event
))
self
.
log
.
debug
(
"
Handling facebook event of type %s
"
,
type
(
event
))
...
...
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