diff -Nru matrix-synapse-1.128.0/debian/changelog matrix-synapse-1.128.0/debian/changelog
--- matrix-synapse-1.128.0/debian/changelog	2025-05-11 05:11:27.000000000 +0800
+++ matrix-synapse-1.128.0/debian/changelog	2025-05-12 10:42:47.000000000 +0800
@@ -1,3 +1,9 @@
+matrix-synapse (1.128.0-1.1) UNRELEASED; urgency=medium
+
+  * raise worker_lock test threshold for riscv. 
+
+ -- Gui-Yue <yuemeng.gui@gmail.com>  Mon, 12 May 2025 10:42:47 +0800
+
 matrix-synapse (1.128.0-1) unstable; urgency=medium
 
   [ Antonio Russo ]
diff -Nru matrix-synapse-1.128.0/debian/patches/rise_worker_lock_test_threshold_for_riscv.patch matrix-synapse-1.128.0/debian/patches/rise_worker_lock_test_threshold_for_riscv.patch
--- matrix-synapse-1.128.0/debian/patches/rise_worker_lock_test_threshold_for_riscv.patch	1970-01-01 08:00:00.000000000 +0800
+++ matrix-synapse-1.128.0/debian/patches/rise_worker_lock_test_threshold_for_riscv.patch	2025-05-12 10:42:47.000000000 +0800
@@ -0,0 +1,56 @@
+--- a/tests/handlers/test_worker_lock.py
++++ b/tests/handlers/test_worker_lock.py
+@@ -28,6 +28,7 @@
+ from tests import unittest
+ from tests.replication._base import BaseMultiWorkerStreamTestCase
+ from tests.utils import test_timeout
++import platform
+ 
+ 
+ class WorkerLockTestCase(unittest.HomeserverTestCase):
+@@ -54,11 +55,26 @@
+     def test_lock_contention(self) -> None:
+         """Test lock contention when a lot of locks wait on a single worker"""
+ 
++        current_machine = platform.machine().lower()
++        if current_machine.startswith('riscv'):
++            # RISC-V specific settings
++            timeout_seconds = 15  # Increased timeout for RISC-V
++            nb_locks_to_test = 500 # Optionally reduce the number of locks for RISC-V
++            #add a print or log statement here for visibility in CI logs
++            print(
++                f"INFO: Detected RISC-V architecture ({current_machine}). "
++                f"Adjusting test_lock_contention: timeout={timeout_seconds}s, nb_locks={nb_locks_to_test}"
++            )
++        else:
++            # Settings for other architectures
++            timeout_seconds = 5
++            nb_locks_to_test = 500
++
+         # It takes around 0.5s on a 5+ years old laptop
+-        with test_timeout(5):
+-            nb_locks = 500
+-            d = self._take_locks(nb_locks)
+-            self.assertEqual(self.get_success(d), nb_locks)
++        with test_timeout(timeout_seconds): # Use the dynamically set timeout
++            # nb_locks = 500 # Original line, now we use nb_locks_to_test
++            d = self._take_locks(nb_locks_to_test) # Use the (potentially adjusted) number of locks
++            self.assertEqual(self.get_success(d), nb_locks_to_test) # Assert against the used number of locks
+ 
+     async def _take_locks(self, nb_locks: int) -> int:
+         locks = [
diff -Nru matrix-synapse-1.128.0/debian/patches/series matrix-synapse-1.128.0/debian/patches/series
--- matrix-synapse-1.128.0/debian/patches/series	2025-05-11 05:11:27.000000000 +0800
+++ matrix-synapse-1.128.0/debian/patches/series	2025-05-12 10:42:24.000000000 +0800
@@ -8,3 +8,4 @@
 downgrade-setuptools-rust.patch
 debian-rust.patch
 debian-rust-mangle.patch
+rise_worker_lock_test_threshold_for_riscv.patch
