public void OnChangeReceived(T change) { if (_isBusy) { Log($"‹{GetType().Name}› cannot process the request to [{nameof(ITargetUpdater<T>.OnChangeReceived)}] while a previous request is running."); return; } _isBusy = true; Task.Run(async() => { try { await ApplyChangesIfNeededAsync(change); } catch (Exception ex) { _logs.Add(ex); } _isBusy = false; }); }
public async Task <List <string> > GetRecords(string fileKey, long startId) { List <string> list = null; var method = nameof(IVersionKeeperServer.GetRecords); using (var conn = new AuthenticHubConnection1(_cfg)) { conn.Error += ex => _log.Add(ex); try { var hub = await conn.ConnectToHub(VersionKeeperHub.Name); list = await hub.Invoke <List <string> >(method, fileKey, startId); } catch (Exception ex) { _log.Add(ex); } } if (list == null) { throw Fault.BadArg(nameof(fileKey), fileKey); } return(list); }