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
ea97bbdc
Commit
ea97bbdc
authored
Mar 06, 2019
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use a weak-ref in the backlog processor, to try to avoid GC collect misses
parent
ea543551
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
PhysicalBridge.cs
src/StackExchange.Redis/PhysicalBridge.cs
+11
-2
No files found.
src/StackExchange.Redis/PhysicalBridge.cs
View file @
ea97bbdc
...
@@ -54,7 +54,10 @@ public PhysicalBridge(ServerEndPoint serverEndPoint, ConnectionType type, int ti
...
@@ -54,7 +54,10 @@ public PhysicalBridge(ServerEndPoint serverEndPoint, ConnectionType type, int ti
Name
=
Format
.
ToString
(
serverEndPoint
.
EndPoint
)
+
"/"
+
ConnectionType
.
ToString
();
Name
=
Format
.
ToString
(
serverEndPoint
.
EndPoint
)
+
"/"
+
ConnectionType
.
ToString
();
TimeoutMilliseconds
=
timeoutMilliseconds
;
TimeoutMilliseconds
=
timeoutMilliseconds
;
_singleWriterMutex
=
new
MutexSlim
(
timeoutMilliseconds
:
timeoutMilliseconds
);
_singleWriterMutex
=
new
MutexSlim
(
timeoutMilliseconds
:
timeoutMilliseconds
);
_weakRefThis
=
new
WeakReference
(
this
);
}
}
private
readonly
WeakReference
_weakRefThis
;
private
readonly
int
TimeoutMilliseconds
;
private
readonly
int
TimeoutMilliseconds
;
public
enum
State
:
byte
public
enum
State
:
byte
...
@@ -741,9 +744,15 @@ private void PushToBacklog(Message message)
...
@@ -741,9 +744,15 @@ private void PushToBacklog(Message message)
private
void
StartBacklogProcessor
()
private
void
StartBacklogProcessor
()
{
{
var
sched
=
Multiplexer
.
SocketManager
?.
SchedulerPool
??
DedicatedThreadPoolPipeScheduler
.
Default
;
var
sched
=
Multiplexer
.
SocketManager
?.
SchedulerPool
??
DedicatedThreadPoolPipeScheduler
.
Default
;
sched
.
Schedule
(
s_ProcessBacklog
,
t
his
);
sched
.
Schedule
(
s_ProcessBacklog
,
_weakRefT
his
);
}
}
static
readonly
Action
<
object
>
s_ProcessBacklog
=
s
=>
((
PhysicalBridge
)
s
).
ProcessBacklog
();
static
readonly
Action
<
object
>
s_ProcessBacklog
=
s
=>
{
var
wr
=
(
WeakReference
)
s
;
var
bridge
=
wr
.
Target
as
PhysicalBridge
;
if
(
bridge
!=
null
)
bridge
.
ProcessBacklog
();
};
private
void
ProcessBacklog
()
private
void
ProcessBacklog
()
{
{
...
...
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