Galaxy Note8 (Android 9) and Pixel 2XL (Android 11).
Typically, Doze mode has a particularly drastic effect on Samsung devices and throttles all possible functions (WiFi connection, timer, CPU etc.) when the device is in the background / idle mode. In order to effectively prevent this on all devices, a Foreground service must be used.
Check it out, if the problem also occurs when the device is connected to a charging cable and charging during the test.