diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-01-25 21:23:35 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-01-25 21:23:35 +0200 |
| commit | 2367c43d732aea2ea169f6fa5844fc877d96632d (patch) | |
| tree | bbd6e675392d6721ad74449c897a87c698ac34b5 /Software/Visual_Studio/Tango.Integration/Storage | |
| parent | 89e7bce0f7241e210aefc9d902e11c8f3537ace9 (diff) | |
| download | Tango-2367c43d732aea2ea169f6fa5844fc877d96632d.tar.gz Tango-2367c43d732aea2ea169f6fa5844fc877d96632d.zip | |
Implemented Hangfire experiment.
Refactored Transporter to accept a configuration instead of multiple parameters on all request/response methods.
Refactored Transporter to automatically log request/response messaged based on configuration.
Fixed issue with ContinuousResponseAborted and external bridge.
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Storage')
| -rw-r--r-- | Software/Visual_Studio/Tango.Integration/Storage/StorageManager.cs | 45 |
1 files changed, 6 insertions, 39 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Storage/StorageManager.cs b/Software/Visual_Studio/Tango.Integration/Storage/StorageManager.cs index 2bf2b7364..2cc95e4a6 100644 --- a/Software/Visual_Studio/Tango.Integration/Storage/StorageManager.cs +++ b/Software/Visual_Studio/Tango.Integration/Storage/StorageManager.cs @@ -88,37 +88,6 @@ namespace Tango.Integration.Storage #endregion - #region Protected Methods - - /// <summary> - /// Logs the request sent. - /// </summary> - /// <param name="message">The message.</param> - protected void LogRequestSent(IMessage message) - { - LogManager.Log($"{_transporter.ComponentName}: Sending request '{message.GetType().Name}'...\n{message.ToJsonString()}", LogCategory.Debug); - } - - /// <summary> - /// Logs the request failed. - /// </summary> - /// <param name="message">The message.</param> - protected void LogRequestFailed(IMessage message, Exception ex) - { - LogManager.Log($"{_transporter.ComponentName}: Request failed '{message.GetType().Name}'...\n{message.ToJsonString()}\n{ex.ToString()}", LogCategory.Error); - } - - /// <summary> - /// Logs the response received. - /// </summary> - /// <param name="message">The message.</param> - protected void LogResponseReceived(IMessage message) - { - LogManager.Log($"{_transporter.ComponentName}: Response received '{message.GetType().Name}'...\n{message.ToJsonString()}", LogCategory.Debug); - } - - #endregion - #region Public Methods /// <summary> @@ -134,11 +103,10 @@ namespace Tango.Integration.Storage try { - response = await _transporter.SendRequest<GetStorageInfoRequest, GetStorageInfoResponse>(request); + response = await _transporter.SendRequest<GetStorageInfoRequest, GetStorageInfoResponse>(request, new TransportRequestConfig() { ShouldLog = true }); } catch (Exception ex) { - LogRequestFailed(request, ex); throw ex; } @@ -189,11 +157,10 @@ namespace Tango.Integration.Storage try { - response = await _transporter.SendRequest<GetFilesRequest, GetFilesResponse>(request); + response = await _transporter.SendRequest<GetFilesRequest, GetFilesResponse>(request, new TransportRequestConfig() { ShouldLog = true }); } catch (Exception ex) { - LogRequestFailed(request, ex); throw ex; } @@ -246,7 +213,7 @@ namespace Tango.Integration.Storage request.Path = path; request.Length = stream.Length; - var fileUploadResponse = await _transporter.SendRequest<FileUploadRequest, FileUploadResponse>(request); + var fileUploadResponse = await _transporter.SendRequest<FileUploadRequest, FileUploadResponse>(request, new TransportRequestConfig() { ShouldLog = true }); String uploadId = fileUploadResponse.Message.UploadID; long max_length = fileUploadResponse.Message.MaxChunkLength; @@ -362,7 +329,7 @@ namespace Tango.Integration.Storage FileDownloadRequest request = new FileDownloadRequest(); request.FileName = file.Path; - var fileDownloadResponse = await _transporter.SendRequest<FileDownloadRequest, FileDownloadResponse>(request); + var fileDownloadResponse = await _transporter.SendRequest<FileDownloadRequest, FileDownloadResponse>(request, new TransportRequestConfig() { ShouldLog = true }); String download_id = fileDownloadResponse.Message.DownloadID; long max_length = fileDownloadResponse.Message.MaxChunkLength; @@ -436,7 +403,7 @@ namespace Tango.Integration.Storage { Path = item.Path, Attribute = item.Attribute, - }); + }, new TransportRequestConfig() { ShouldLog = true }); } /// <summary> @@ -450,7 +417,7 @@ namespace Tango.Integration.Storage { Path = path, Attribute = FileAttribute.Directory, - }); + }, new TransportRequestConfig() { ShouldLog = true }); } #endregion |
