Commit 98b24b5
fix(cache): pass watch keys to Transaction so optimistic lock actually works (#701)
* feat(redis): add Redis Cluster client path to plugin-daemon
Wire the missing third branch so operators can point the daemon at a
Redis Cluster without falling back to dialing an empty REDIS_HOST:PORT
and panicking at startup.
* introduce REDIS_USE_CLUSTERS / REDIS_CLUSTERS /
REDIS_CLUSTERS_PASSWORD envs, aligned with dify api naming so Helm
can set a single env group
* branch in PluginManager.Launch for Cluster ahead of the existing
Sentinel / standalone paths; falls back to REDIS_PASSWORD if the
cluster-specific password is not set
* implement cache.InitRedisClusterClient via redis.NewClusterClient;
downstream cache / lock / pub-sub helpers keep working because
`client` is declared as redis.UniversalClient
Redis Cluster disables SELECT DB, so the cluster branch does not
plumb RedisDB. This is intentional and documented in the release
note accompanying the overall Redis Cluster support work.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(redis): validate Redis cluster addresses and improve transaction handling
* feat(redis): implement CSV parsing utility and refactor Redis transaction handling
* feat(redis): scope plugin-daemon to standalone + sentinel only
Narrow the plugin-daemon Redis client to standalone and sentinel modes;
remove the cluster code paths that were briefly exercised on this branch.
Changes:
- Remove REDIS_USE_CLUSTERS / REDIS_CLUSTERS / REDIS_CLUSTERS_PASSWORD
env fields from app.Config.
- Remove the cluster branch (plus the two cluster-specific fail-fast
guards on REDIS_USE_CLUSTERS + REDIS_USE_SENTINEL and REDIS_DB != 0)
from PluginManager.Launch. The init block is now just sentinel or
standalone.
- Delete cache.InitRedisClusterClient. The main redis client + all
helpers (Transaction, pub/sub, lock, etc.) already route through
redis.UniversalClient so downstream code needs no adjustment.
Intentionally kept:
- Transaction(fn, watchKeys...) signature: the variadic signature is
backwards-compatible with every existing Transaction(fn) call and the
one new-style caller (debugging_service) benefits from real WATCH
semantics even on standalone — this is correctness-independent of
cluster support.
- parser.SplitAndTrimCSV: the sentinel branch migrated to it in 617e7a5
and still uses it to parse REDIS_SENTINELS, so the helper has a
standalone/sentinel consumer and stays.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 41f89d2 commit 98b24b5
5 files changed
Lines changed: 66 additions & 6 deletions
File tree
- internal
- core/plugin_manager
- service/debugging_service
- pkg/utils
- cache
- parser
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
51 | | - | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | | - | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
585 | | - | |
| 585 | + | |
586 | 586 | | |
587 | 587 | | |
588 | 588 | | |
589 | 589 | | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
590 | 595 | | |
591 | 596 | | |
592 | 597 | | |
| |||
595 | 600 | | |
596 | 601 | | |
597 | 602 | | |
598 | | - | |
| 603 | + | |
599 | 604 | | |
600 | 605 | | |
601 | 606 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
0 commit comments