Commit Graph

26 Commits

Author SHA1 Message Date
Sam Saffron 4ea21fa2d0 DEV: use #frozen_string_literal: true on all spec
This change both speeds up specs (less strings to allocate) and helps catch
cases where methods in Discourse are mutating inputs.

Overall we will be migrating everything to use #frozen_string_literal: true
it will take a while, but this is the first and safest move in this direction
2019-04-30 10:27:42 +10:00
Guo Xiang Tan f6f2c38183 FIX: Fallback Redis by checking status on master instead of slave. 2019-01-22 12:38:12 +08:00
Guo Xiang Tan 38ded77e16 FIX: Make test less fragile. 2019-01-02 16:33:50 +08:00
Guo Xiang Tan 2cbb513c98 FIX: Don't use `Redis#keys` in production.
As per the documentation for KEYS

```
Warning: consider KEYS as a command that should only be used in production environments with extreme care. It may ruin performance when it is executed against large databases. This command is intended for debugging and special operations, such as changing your keyspace layout.
```

Instead SCAN

```
Since these commands allow for incremental iteration, returning only a small number of elements per call, they can be used in production without the downside of commands like KEYS or SMEMBERS that may block the server for a long time (even several seconds) when called against big collections of keys or elements.
```
2018-12-25 15:12:59 +02:00
Guo Xiang Tan f623740ffc DEV: Stablize DiscourseRedis tests. 2018-05-30 14:45:19 +08:00
Guo Xiang Tan 98d880b67a Missed a spot in 45fe5dc793 2018-04-20 13:59:19 +08:00
Sam 877b7be579 FIX: in readonly mode don't double count pages 2017-10-25 13:19:43 +11:00
Guo Xiang Tan b2127600fb Remove use of concurrent timer for Redis failover.
* Uses the same logic for Postgres failover.
2017-10-05 15:57:08 +08:00
Guo Xiang Tan b5bbb8ae8a Fix failing spec. 2017-10-02 13:16:01 +08:00
Guo Xiang Tan 68b8acbcfa Make Redis test less brittle. 2017-08-24 10:00:15 +09:00
Sam e8cdb1d8a7 correct flaky spec 2017-08-22 16:54:29 -04:00
Sam aeedecd27c correct erratically failing spec 2017-08-18 15:10:37 -04:00
Guo Xiang Tan 9bc3038728 Fix Redis command errors when trying to start app with a readonly Redis. 2017-08-02 21:33:56 +09:00
Guo Xiang Tan 5b76b9e888 Ensure that we cleanup after tests. 2017-08-01 23:42:26 +09:00
Guo Xiang Tan 7d5b6e2b3c Disable MessageBus's keepalive when Redis is readonly. 2017-08-01 23:07:52 +09:00
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Guo Xiang Tan 02025207d5 FIX: Make sure Redis fallback don't fall into a permanent readonly state. 2016-11-23 11:31:20 +08:00
Guo Xiang Tan fbbcde1230 FIX: Don't treat master as up if it is still loading data. 2016-11-07 15:28:10 +08:00
Guo Xiang Tan 9375dcb6fe PERF: Spawn a seperate timer task to check if Redis master is up. 2016-11-07 15:04:28 +08:00
Guo Xiang Tan 36e3f1f5e4
FIX: Reset state of `DiscourseRedis::FallbackHandler` in tests. 2016-04-18 10:41:40 +08:00
Guo Xiang Tan 862b4fc9da
FIX: `DiscourseRedis::FallbackHandler` not restricting number of threads spawned. 2016-04-15 17:05:03 +08:00
Guo Xiang Tan 60c21a3393 Extract valid connection types into a constant. 2016-04-07 15:45:42 +08:00
Guo Xiang Tan 48e118a054 DRY up tests. 2016-04-07 15:43:33 +08:00
Guo Xiang Tan 7f6fe8fe13 FIX: Pubsub connections need to be killed too. 2016-04-07 15:30:05 +08:00
Guo Xiang Tan bf209d8344 FIX: Redis hostname may resolve to nothing. 2016-03-11 19:06:37 +08:00
Guo Xiang Tan c07c474575 FEATURE: Master-Slave Redis configuration with fallback and switch over. 2016-03-11 12:18:58 +08:00