Skip to content
This repository was archived by the owner on Mar 23, 2020. It is now read-only.

Commit 3271f49

Browse files
committed
Use separate history token Room attribute
When loading new events, Client resets Room.prev_batch matrix-org#284 (comment)
1 parent 0983cfa commit 3271f49

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

matrix_client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
__version__ = "0.4.2-dev-2"
16+
__version__ = "0.4.2-dev-3"

matrix_client/room.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def __init__(self, client, room_id, verify_devices=False):
4848
self.invite_only = None
4949
self.guest_access = None
5050
self._prev_batch = None
51+
self._history_token = None
5152
self._members = {}
5253
self.members_displaynames = {
5354
# user_id: displayname
@@ -566,12 +567,13 @@ def backfill_previous_messages(self, reverse=False, limit=10):
566567
if self.loaded_all_history:
567568
return
568569

569-
res = self.client.api.get_room_messages(self.room_id, self.prev_batch,
570-
direction="b", limit=limit)
571-
if res["end"] == self.prev_batch:
570+
res = self.client.api.get_room_messages(
571+
self.room_id, self._history_token, direction="b", limit=limit
572+
)
573+
if res["end"] == self._history_token:
572574
self.loaded_all_history = True
573575
return
574-
self.prev_batch = res["end"]
576+
self._history_token = res["end"]
575577

576578
events = res["chunk"]
577579
if not reverse:

0 commit comments

Comments
 (0)