File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed
Src/StackifyLib/Internal/Logs Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -126,10 +126,8 @@ public bool ErrorShouldBeSent(StackifyError error)
126126
127127
128128
129- private long ? LastEpochMs = 0 ;
130- private object locker = new object ( ) ;
131- private int count ;
132-
129+ private static long _lastEpochMs = 0 ;
130+ private static int _millisecondCount = 0 ;
133131
134132 public void QueueMessage ( LogMsg msg )
135133 {
@@ -148,21 +146,19 @@ public void QueueMessage(LogMsg msg)
148146 }
149147
150148 // works on the assumption that the epochMS will always be incrementing as it reaches this point
151- if ( LastEpochMs < msg . EpochMs )
149+ if ( _lastEpochMs < msg . EpochMs )
152150 {
153151 // reset counter if we are no longer in the same ms
154- lock ( locker )
155- {
156- //https://msdn.microsoft.com/en-us/library/system.threading.interlocked_methods(v=vs.110).aspx
157- LastEpochMs = msg . EpochMs ;
158- Interlocked . Exchange ( ref count , 0 ) ;
159- msg . Order = 0 ;
160- }
152+ //https://msdn.microsoft.com/en-us/library/system.threading.interlocked_methods(v=vs.110).aspx
153+ Interlocked . Exchange ( ref _lastEpochMs , msg . EpochMs ) ;
154+ Interlocked . Exchange ( ref _millisecondCount , 0 ) ;
155+ msg . Order = 0 ;
161156 }
162- else
157+ else if ( _lastEpochMs == msg . EpochMs )
163158 {
164- msg . Order = Interlocked . Increment ( ref count ) ;
159+ msg . Order = Interlocked . Increment ( ref _millisecondCount ) ;
165160 }
161+ // else defaulted to 0
166162
167163 //Used by Stackify profiler only
168164 if ( Logger . PrefixEnabled ( ) )
You can’t perform that action at this time.
0 commit comments