Skip to content

Commit e3fafa9

Browse files
committed
add a note to the Operation Store AR guide about test environments
By default, `last_used_at` timestamps are updated every 5 seconds in a background thread. However, in a test environment, this can cause some surprising and unintended side effects when the background thread update is delayed until after a test finishes, and the test transaction has been rolled back.
1 parent fe83e38 commit e3fafa9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

guides/operation_store/active_record_backend.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,10 @@ use GraphQL::Pro::OperationStore, update_last_used_at_every: 1 # seconds
9393
```
9494

9595
To update that column inline each time an operation is accessed, pass `0`.
96+
97+
**Note:** It is recommended to set this to `0` in test environments, to avoid delayed updates in another thread that can cause intermittent test hangs and failures. For example:
98+
99+
```ruby
100+
# Update immediately in Test, wait 5 seconds in other environments:
101+
use GraphQL::Pro::OperationStore, update_last_used_at_every: Rails.env.test? ? 0 : 5
102+
```

0 commit comments

Comments
 (0)