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
6dd621b5
Commit
6dd621b5
authored
Sep 12, 2018
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tessts for #943 (also, unrelated, move libver to later in the exception)
parent
1305424b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
2 deletions
+37
-2
ExceptionFactory.cs
src/StackExchange.Redis/ExceptionFactory.cs
+3
-1
PhysicalConnection.cs
src/StackExchange.Redis/PhysicalConnection.cs
+2
-1
Transactions.cs
tests/StackExchange.Redis.Tests/Transactions.cs
+32
-0
No files found.
src/StackExchange.Redis/ExceptionFactory.cs
View file @
6dd621b5
...
@@ -200,7 +200,7 @@ void add(string lk, string sk, string v)
...
@@ -200,7 +200,7 @@ void add(string lk, string sk, string v)
sb
.
Append
(
", "
).
Append
(
sk
).
Append
(
": "
).
Append
(
v
);
sb
.
Append
(
", "
).
Append
(
sk
).
Append
(
": "
).
Append
(
v
);
}
}
}
}
add
(
"Version"
,
"v"
,
GetLibVersion
());
if
(
server
!=
null
)
if
(
server
!=
null
)
{
{
server
.
GetOutstandingCount
(
message
.
Command
,
out
int
inst
,
out
int
qs
,
out
int
@in
);
server
.
GetOutstandingCount
(
message
.
Command
,
out
int
inst
,
out
int
qs
,
out
int
@in
);
...
@@ -235,6 +235,8 @@ void add(string lk, string sk, string v)
...
@@ -235,6 +235,8 @@ void add(string lk, string sk, string v)
add
(
"Local-CPU"
,
"Local-CPU"
,
PerfCounterHelper
.
GetSystemCpuPercent
());
add
(
"Local-CPU"
,
"Local-CPU"
,
PerfCounterHelper
.
GetSystemCpuPercent
());
}
}
add
(
"Version"
,
"v"
,
GetLibVersion
());
sb
.
Append
(
" (Please take a look at this article for some common client-side issues that can cause timeouts: "
);
sb
.
Append
(
" (Please take a look at this article for some common client-side issues that can cause timeouts: "
);
sb
.
Append
(
timeoutHelpLink
);
sb
.
Append
(
timeoutHelpLink
);
sb
.
Append
(
")"
);
sb
.
Append
(
")"
);
...
...
src/StackExchange.Redis/PhysicalConnection.cs
View file @
6dd621b5
...
@@ -333,7 +333,6 @@ void add(string lk, string sk, string v)
...
@@ -333,7 +333,6 @@ void add(string lk, string sk, string v)
data
.
Add
(
Tuple
.
Create
(
lk
,
v
));
data
.
Add
(
Tuple
.
Create
(
lk
,
v
));
exMessage
.
Append
(
", "
).
Append
(
sk
).
Append
(
": "
).
Append
(
v
);
exMessage
.
Append
(
", "
).
Append
(
sk
).
Append
(
": "
).
Append
(
v
);
}
}
add
(
"Version"
,
"v"
,
ExceptionFactory
.
GetLibVersion
());
if
(
IncludeDetailInExceptions
)
if
(
IncludeDetailInExceptions
)
{
{
...
@@ -370,6 +369,8 @@ void add(string lk, string sk, string v)
...
@@ -370,6 +369,8 @@ void add(string lk, string sk, string v)
}
}
}
}
add
(
"Version"
,
"v"
,
ExceptionFactory
.
GetLibVersion
());
outerException
=
innerException
==
null
outerException
=
innerException
==
null
?
new
RedisConnectionException
(
failureType
,
exMessage
.
ToString
())
?
new
RedisConnectionException
(
failureType
,
exMessage
.
ToString
())
:
new
RedisConnectionException
(
failureType
,
exMessage
.
ToString
(),
innerException
);
:
new
RedisConnectionException
(
failureType
,
exMessage
.
ToString
(),
innerException
);
...
...
tests/StackExchange.Redis.Tests/Transactions.cs
View file @
6dd621b5
...
@@ -950,5 +950,37 @@ public async Task WatchAbort_HashLengthEqual()
...
@@ -950,5 +950,37 @@ public async Task WatchAbort_HashLengthEqual()
}
}
#endif
#endif
[
Fact
]
public
async
Task
ExecCompletes_Issue943
()
{
int
hashHit
=
0
,
hashMiss
=
0
,
expireHit
=
0
,
expireMiss
=
0
;
using
(
var
conn
=
Create
())
{
var
db
=
conn
.
GetDatabase
();
for
(
int
i
=
0
;
i
<
40000
;
i
++)
{
RedisKey
key
=
Me
();
await
db
.
KeyDeleteAsync
(
key
);
HashEntry
[]
hashEntries
=
new
HashEntry
[]
{
new
HashEntry
(
"blah"
,
DateTime
.
UtcNow
.
ToString
(
"R"
))
};
ITransaction
transaction
=
db
.
CreateTransaction
();
ConditionResult
keyNotExists
=
transaction
.
AddCondition
(
Condition
.
KeyNotExists
(
key
));
Task
hashSetTask
=
transaction
.
HashSetAsync
(
key
,
hashEntries
);
Task
<
bool
>
expireTask
=
transaction
.
KeyExpireAsync
(
key
,
TimeSpan
.
FromSeconds
(
30
));
bool
committed
=
await
transaction
.
ExecuteAsync
();
if
(
committed
)
{
if
(
hashSetTask
.
IsCompleted
)
hashHit
++;
else
hashMiss
++;
if
(
expireTask
.
IsCompleted
)
expireHit
++;
else
expireMiss
++;
await
hashSetTask
;
await
expireTask
;
}
}
}
Writer
.
WriteLine
(
$"hash hit:
{
hashHit
}
, miss:
{
hashMiss
}
; expire hit:
{
expireHit
}
, miss:
{
expireMiss
}
"
);
}
}
}
}
}
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