1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-12 10:26:27 +00:00

Added periodic identifier

This commit is contained in:
Jkorf 2021-12-06 16:18:18 +01:00
parent 60ec18919a
commit 48baaeb2d8
2 changed files with 6 additions and 5 deletions

View File

@ -47,12 +47,12 @@ namespace CryptoExchange.Net.UnitTests.TestImplementations
throw new NotImplementedException(); throw new NotImplementedException();
} }
protected internal override bool MessageMatchesHandler(JToken message, object request) protected internal override bool MessageMatchesHandler(SocketConnection s, JToken message, object request)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
protected internal override bool MessageMatchesHandler(JToken message, string identifier) protected internal override bool MessageMatchesHandler(SocketConnection s, JToken message, string identifier)
{ {
return true; return true;
} }

View File

@ -567,9 +567,10 @@ namespace CryptoExchange.Net
/// <summary> /// <summary>
/// Periodically sends data over a socket connection /// Periodically sends data over a socket connection
/// </summary> /// </summary>
/// <param name="identifier">Identifier for the periodic send</param>
/// <param name="interval">How often</param> /// <param name="interval">How often</param>
/// <param name="objGetter">Method returning the object to send</param> /// <param name="objGetter">Method returning the object to send</param>
public virtual void SendPeriodic(TimeSpan interval, Func<SocketConnection, object> objGetter) public virtual void SendPeriodic(string identifier, TimeSpan interval, Func<SocketConnection, object> objGetter)
{ {
if (objGetter == null) if (objGetter == null)
throw new ArgumentNullException(nameof(objGetter)); throw new ArgumentNullException(nameof(objGetter));
@ -595,7 +596,7 @@ namespace CryptoExchange.Net
if (obj == null) if (obj == null)
continue; continue;
log.Write(LogLevel.Trace, $"Socket {socket.Socket.Id} sending periodic"); log.Write(LogLevel.Trace, $"Socket {socket.Socket.Id} sending periodic {identifier}");
try try
{ {
@ -603,7 +604,7 @@ namespace CryptoExchange.Net
} }
catch (Exception ex) catch (Exception ex)
{ {
log.Write(LogLevel.Warning, $"Socket {socket.Socket.Id} Periodic send failed: " + ex); log.Write(LogLevel.Warning, $"Socket {socket.Socket.Id} Periodic send {identifier} failed: " + ex);
} }
} }
} }