fix: Don't wait for 5 milliseconds on every sync in our tests
This was added in 77be6102f6 without much
documentation. I am pretty sure the intent was never to slow down every
test by 5 seconds, so let's get rid of it and do more careful delays
where it is useful (like specific sync requests for example).
Makes the tests run 5 times faster (the whole suite!) on my device.
This commit is contained in:
parent
2085964a68
commit
b74dbdea4a
|
|
@ -127,10 +127,6 @@ class FakeMatrixApi extends BaseClient {
|
||||||
|
|
||||||
//print('\$method request to $action with Data: $data');
|
//print('\$method request to $action with Data: $data');
|
||||||
|
|
||||||
// Sync requests with timeout
|
|
||||||
if (data is Map<String, dynamic> && data['timeout'] is String) {
|
|
||||||
await Future.delayed(Duration(seconds: 5));
|
|
||||||
}
|
|
||||||
if (!servers.contains(request.url.origin)) {
|
if (!servers.contains(request.url.origin)) {
|
||||||
return Response(
|
return Response(
|
||||||
'<html><head></head><body>Not found ${request.url.origin}...</body></html>',
|
'<html><head></head><body>Not found ${request.url.origin}...</body></html>',
|
||||||
|
|
@ -202,6 +198,11 @@ class FakeMatrixApi extends BaseClient {
|
||||||
'/client/v3/rooms/!1234%3AfakeServer.notExisting/state/')) {
|
'/client/v3/rooms/!1234%3AfakeServer.notExisting/state/')) {
|
||||||
res = {'event_id': '\$event${_eventCounter++}'};
|
res = {'event_id': '\$event${_eventCounter++}'};
|
||||||
} else if (action.contains('/client/v3/sync')) {
|
} else if (action.contains('/client/v3/sync')) {
|
||||||
|
// Sync requests with timeout
|
||||||
|
final timeout = request.url.queryParameters['timeout'];
|
||||||
|
if (timeout != null && timeout != '0') {
|
||||||
|
await Future.delayed(Duration(milliseconds: 50));
|
||||||
|
}
|
||||||
res = {
|
res = {
|
||||||
'next_batch': DateTime.now().millisecondsSinceEpoch.toString(),
|
'next_batch': DateTime.now().millisecondsSinceEpoch.toString(),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue