Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
StackExchange.Redis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
StackExchange.Redis
Commits
f9c7e582
Commit
f9c7e582
authored
Mar 16, 2018
by
Nick Craver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests: move SubscriptionsSurviveConnectionFailure to async
parent
79278c62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
PubSub.cs
StackExchange.Redis.Tests/PubSub.cs
+9
-7
No files found.
StackExchange.Redis.Tests/PubSub.cs
View file @
f9c7e582
...
@@ -254,29 +254,31 @@ public void TestPatternPubSub(bool preserveOrder)
...
@@ -254,29 +254,31 @@ public void TestPatternPubSub(bool preserveOrder)
#if DEBUG
#if DEBUG
[
Fact
]
[
Fact
]
public
void
SubscriptionsSurviveConnectionFailure
()
public
async
Task
SubscriptionsSurviveConnectionFailureAsync
()
{
{
using
(
var
muxer
=
Create
(
allowAdmin
:
true
))
using
(
var
muxer
=
Create
(
allowAdmin
:
true
))
{
{
RedisChannel
channel
=
Me
();
RedisChannel
channel
=
Me
();
var
sub
=
muxer
.
GetSubscriber
();
var
sub
=
muxer
.
GetSubscriber
();
int
counter
=
0
;
int
counter
=
0
;
sub
.
Subscribe
(
channel
,
delegate
await
sub
.
SubscribeAsync
(
channel
,
delegate
{
{
Interlocked
.
Increment
(
ref
counter
);
Interlocked
.
Increment
(
ref
counter
);
});
})
.
ConfigureAwait
(
false
)
;
sub
.
Publish
(
channel
,
"abc"
);
await
sub
.
PublishAsync
(
channel
,
"abc"
).
ConfigureAwait
(
false
);
sub
.
Ping
();
sub
.
Ping
();
await
Task
.
Delay
(
200
).
ConfigureAwait
(
false
);
Assert
.
Equal
(
1
,
VolatileWrapper
.
Read
(
ref
counter
));
Assert
.
Equal
(
1
,
VolatileWrapper
.
Read
(
ref
counter
));
var
server
=
GetServer
(
muxer
);
var
server
=
GetServer
(
muxer
);
Assert
.
Equal
(
1
,
server
.
GetCounters
().
Subscription
.
SocketCount
);
Assert
.
Equal
(
1
,
server
.
GetCounters
().
Subscription
.
SocketCount
);
server
.
SimulateConnectionFailure
();
server
.
SimulateConnectionFailure
();
SetExpectedAmbientFailureCount
(
2
);
SetExpectedAmbientFailureCount
(
2
);
Thread
.
Sleep
(
100
);
await
Task
.
Delay
(
200
).
ConfigureAwait
(
false
);
sub
.
Ping
();
sub
.
Ping
();
Assert
.
Equal
(
2
,
server
.
GetCounters
().
Subscription
.
SocketCount
);
Assert
.
Equal
(
2
,
server
.
GetCounters
().
Subscription
.
SocketCount
);
sub
.
Publish
(
channel
,
"abc"
);
await
sub
.
PublishAsync
(
channel
,
"abc"
).
ConfigureAwait
(
false
);
await
Task
.
Delay
(
200
).
ConfigureAwait
(
false
);
sub
.
Ping
();
sub
.
Ping
();
Assert
.
Equal
(
2
,
VolatileWrapper
.
Read
(
ref
counter
));
Assert
.
Equal
(
2
,
VolatileWrapper
.
Read
(
ref
counter
));
}
}
...
@@ -295,4 +297,4 @@ public static int Read(ref int location)
...
@@ -295,4 +297,4 @@ public static int Read(ref int location)
#endif
#endif
}
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment