mautrix / facebook

A Matrix-Facebook Messenger puppeting bridge
https://matrix.to/#/#facebook:maunium.net
GNU Affero General Public License v3.0
389 stars 64 forks source link

Getting rate limited by facebook server #182

Open pictuga opened 3 years ago

pictuga commented 3 years ago

When doing the initial backfill, the bridge seems to be rate limited by facebook

This results in empty conversations

Is there some way to handle this?

[DEBUG@mau.portal.123456789<->123456789] Matrix room created: !xyz:example.com
[INFO@aiohttp.access] 127.0.0.1 [14/Oct/2021:06:15:23 +0000] "PUT /transactions/796?access_token=xyz
IV-xyz-Nt HTTP/1.1" 200 158 "-" "Synapse/1.44.0"
[DEBUG@mau.user.@user:example.com.@user:example.com] Updating m.direct list on homeserver
[INFO@aiohttp.access] 127.0.0.1 [14/Oct/2021:06:15:23 +0000] "PUT /transactions/797?access_token=xyz
IV-xyz-Nt HTTP/1.1" 200 158 "-" "Synapse/1.44.0"
[DEBUG@mau.portal.123456789<->123456789] Backfilling history through @user:example.com
[DEBUG@mau.portal.123456789<->123456789] Fetching up to 123456789 messages through 123456789
[ERROR@mau.portal.123456789<->123456789] Failed to backfill new portal
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/mautrix_facebook/portal.py", line 527, in _create_matrix_room
    await self.backfill(source, is_initial=True, thread=info)
  File "/usr/lib/python3.9/site-packages/mautrix_facebook/portal.py", line 1344, in backfill
    await self._backfill(source, limit, most_recent.timestamp if most_recent else None,
  File "/usr/lib/python3.9/site-packages/mautrix_facebook/portal.py", line 1355, in _backfill
    resp = await source.client.fetch_messages(self.fbid, before_timestamp)
  File "/opt/mautrix-facebook/maufbapi/http/api.py", line 50, in fetch_messages
    return await self.graphql(MoreMessagesQuery(thread_id=str(thread_id),
  File "/opt/mautrix-facebook/maufbapi/http/base.py", line 192, in graphql
    json_data = await self._handle_response(resp)
  File "/opt/mautrix-facebook/maufbapi/http/base.py", line 209, in _handle_response
    raise error_class(error)
maufbapi.http.errors.OAuthException: It looks like you were misusing this feature by going too fast. You_ve been temporarily blocked from using it.
[DEBUG@mau.user.@user:example.com.@user:example.com] Syncing thread 123456789
[INFO@aiohttp.access] 127.0.0.1 [14/Oct/2021:06:15:24 +0000] "PUT /transactions/798?access_token=xyz
IV-xyz-Nt HTTP/1.1" 200 158 "-" "Synapse/1.44.0"
[DEBUG@mau.mx] @user:example.com joined !xyz:example.com
[DEBUG@mau.portal.123456789] Creating Matrix room
[WARNING@mau.portal.123456789] Got empty name in _update_name call
[DEBUG@mau.portal.123456789] Not updating bridge info: no Matrix room created
CarlAmbroselli commented 2 years ago

@tulir facing the same, how does beeper solve this? Not backfilling thousands of old messages but limiting to a few hundreds? Or limiting bandwidth to prevent it from being too fast?

What's the reason why the backfill skips rooms that have no messages in matrix?

Not backfilling redacted-number<->redacted-number: no most recent message found