gristlabs_grist-core/test/common
Dmitry S 2705d41c34 (core) Add timeouts to prevent ActiveDoc bad state during shutdown.
Summary:
Add two shutdown-related timeouts.

1. One is to limit the duration of any work that happens once shutdown
   begins. In particular, waiting for an update to current time could block
   indefinitely if the data engine is unresponsive. Such awaits are now
   limited to 5 seconds.

2. The other is to allow documents to get shutdown for inactivity even when
   some work takes forever. Certain work (e.g. applying user actions)
   generally prevents a document from shutting down while it's pending. This
   prevention is now limited to 5 minutes.

   Shutting down a doc while something is pending may break some
   assumptions, and lead to errors. The timeout is long to let us assume
   that the work is stuck, and that errors are better than waiting forever.

Other changes:
- Periodic ActiveDoc work (intervals) is now started when a doc finishes
  loading rather than in the constructor. The difference only showed up in
  tests which makes the intervals much shorter.

- Move timeoutReached() utility function to gutil, and use it for
  isLongerThan(), since they are basically identical. Also makes sure that the
  timer in these is cleared in all cases.

- Remove duplicate waitForIt implementation (previously had a copy in both
  test/server and core/test/server).

- Change testUtil.captureLog to pass messages to its callback, to allow asserts
  on messages within the callback.

Test Plan:
Added new unittests for the new shutdowns, including a replication
of a bad state that was possible during shutdown.

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D4040
2023-09-26 15:32:49 -04:00
..
ACLPermissions.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
arraySplice.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
AsyncCreate.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
BigInt.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
BinaryIndexedTree.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
ChoiceListParser.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
CircularArray.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
ColumnFilterFunc.ts (core) Fix date filter for DateTime columns. 2023-01-18 10:18:15 +01:00
csvFormat.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
DocActions.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
getTableTitle.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
gristUrls.ts Add appearance parameter to override theme preferences (#620) 2023-08-15 10:29:29 -07:00
gutil2.ts (core) Add timeouts to prevent ActiveDoc bad state during shutdown. 2023-09-26 15:32:49 -04:00
gutil.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
InactivityTimer.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
Interval.ts (core) Fix bugs with intervals 2022-08-25 12:38:36 -07:00
KeyedMutex.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
marshal.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
MemBuffer.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
NumberFormat.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
NumberParse.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
parseDate.ts give parseDate test more time (#278) 2022-09-09 17:05:29 -04:00
PluginInstance.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
promises.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
RecentItems.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
RefCountMap.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
RelativeDates.ts (core) New date filter with a calendar view 2022-12-20 09:58:42 +01:00
roles.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
serializeTiming.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
SortFunc.ts (core) Fix the empty values last option in multicol sorting 2023-01-31 12:14:22 +01:00
sortTiming.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
StringUnion.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
TableData.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
Telemetry.ts (core) Add earliestDocCreatedAt to telemetry 2023-08-08 00:48:18 -07:00
timeFormat.js (core) bump mocha version to allow parallel tests; move more tests to core 2023-06-27 02:55:34 -04:00
tsvFormat.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
ValueFormatter.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00
ValueGuesser.ts (core) Moving client and common tests to core 2022-08-23 19:20:10 +02:00