Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 547a37c

Browse files
committed
Return read/write client if on read-only clients exist
1 parent 6acf8b1 commit 547a37c

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/ServiceStack.Redis/BasicRedisClientManager.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ public IRedisClient GetClient()
107107
/// <returns></returns>
108108
public virtual IRedisClient GetReadOnlyClient()
109109
{
110+
if (ReadOnlyHosts.Count == 0)
111+
return this.GetClient();
112+
110113
var nextHost = ReadOnlyHosts[readOnlyHostsIndex++ % ReadOnlyHosts.Count];
111114
var client = InitNewClient(nextHost);
112115
return client;

src/ServiceStack.Redis/PooledRedisClientManager.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ private void InitClient(RedisClient client)
303303
/// <returns></returns>
304304
public virtual IRedisClient GetReadOnlyClient()
305305
{
306+
if (ReadOnlyHosts.Count == 0)
307+
return this.GetClient();
308+
306309
lock (readClients)
307310
{
308311
AssertValidReadOnlyPool();

0 commit comments

Comments
 (0)