Skip to content

Commit ae27bd6

Browse files
authored
Merge pull request #19 from Project-MONAI/vchang/gh-18
Use synchronous call to copy stream in GetObject* calls
2 parents 9612cb4 + eda7afc commit ae27bd6

File tree

2 files changed

+34
-9
lines changed

2 files changed

+34
-9
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,32 @@ jobs:
234234
name: Publish to GitHub Packages
235235
runs-on: ubuntu-latest
236236
needs: [build, unit-test]
237+
if: ${{ ! ( github.event.inputs.nuget ) }}
238+
steps:
239+
- uses: actions/download-artifact@v2
240+
id: download
241+
242+
- name: List artifacts
243+
run: ls -ldR ${{steps.download.outputs.download-path}}/**/*
244+
245+
- name: Install grp
246+
run: dotnet tool install gpr -g
247+
248+
- uses: actions/setup-dotnet@v1
249+
env:
250+
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
251+
with:
252+
dotnet-version: "6.0.x"
253+
source-url: https://nuget.pkg.github.com/Project-MONAI/index.json
254+
255+
- name: Publish to GitHub
256+
run: gpr push '${{ steps.download.outputs.download-path }}/nuget/*.nupkg' --repository ${{ github.repository }} -k ${{ secrets.GITHUB_TOKEN }}
257+
258+
release-nuget:
259+
name: Official Release to GitHub Packages
260+
runs-on: ubuntu-latest
261+
needs: [build, unit-test]
262+
if: ${{ github.event.inputs.nuget }}
237263
steps:
238264
- uses: actions/download-artifact@v2
239265
id: download
@@ -296,6 +322,8 @@ jobs:
296322
repository: ${{ steps.repo.outputs._1 }}
297323
milestone: ${{ env.MAJORMINORPATCH }}
298324
name: Release v${{ env.MAJORMINORPATCH }}
325+
assets: |
326+
${{ steps.download.outputs.download-path }}/plug-ins/*.zip
299327
300328
- name: Publish release with GitReleaseManager
301329
if: ${{ contains(github.ref, 'refs/heads/main') }}

src/Plugins/MinIO/MinIoStorageService.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,10 @@ public async Task<Stream> GetObjectAsync(string bucketName, string objectName, C
6767
Guard.Against.NullOrWhiteSpace(bucketName, nameof(bucketName));
6868
Guard.Against.NullOrWhiteSpace(objectName, nameof(objectName));
6969

70-
var stream = new MemoryStream();
71-
7270
var client = _minioClientFactory.GetClient();
73-
await GetObjectUsingClient(client, bucketName, objectName, async (s) => await s.CopyToAsync(stream), cancellationToken).ConfigureAwait(false);
74-
71+
var stream = new MemoryStream();
72+
await GetObjectUsingClient(client, bucketName, objectName, (s) => s.CopyTo(stream), cancellationToken).ConfigureAwait(false);
73+
stream.Seek(0, SeekOrigin.Begin);
7574
return stream;
7675
}
7776

@@ -219,12 +218,10 @@ public async Task<Stream> GetObjectWithCredentialsAsync(string bucketName, strin
219218
Guard.Against.NullOrWhiteSpace(bucketName, nameof(bucketName));
220219
Guard.Against.NullOrWhiteSpace(objectName, nameof(objectName));
221220

222-
var stream = new MemoryStream();
223-
224221
var client = _minioClientFactory.GetClient(credentials, _options.Settings[ConfigurationKeys.Region]);
225-
226-
await GetObjectUsingClient(client, bucketName, objectName, async (s) => await s.CopyToAsync(stream), cancellationToken).ConfigureAwait(false);
227-
222+
var stream = new MemoryStream();
223+
await GetObjectUsingClient(client, bucketName, objectName, (s) => s.CopyTo(stream), cancellationToken).ConfigureAwait(false);
224+
stream.Seek(0, SeekOrigin.Begin);
228225
return stream;
229226
}
230227

0 commit comments

Comments
 (0)