Skip to content

Commit

Permalink
Merge pull request #149 from Dynatrace/fix-nre-upload
Browse files Browse the repository at this point in the history
fix NRE when uploading multiple dumps at once
  • Loading branch information
discostu105 authored Dec 18, 2018
2 parents 98cec39 + f3b29dd commit b555d24
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/SuperDumpService/Services/DumpRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public IEnumerable<DumpMetainfo> GetAll() {
public async Task<DumpMetainfo> CreateDump(string bundleId, FileInfo sourcePath) {
DumpMetainfo dumpInfo;
string dumpId;
var dict = new ConcurrentDictionary<string, DumpMetainfo>();
dumpId = CreateUniqueDumpId();
dumpInfo = new DumpMetainfo() {
BundleId = bundleId,
Expand All @@ -78,8 +77,8 @@ public async Task<DumpMetainfo> CreateDump(string bundleId, FileInfo sourcePath)
Created = DateTime.Now,
Status = DumpStatus.Created
};
dict[dumpId] = dumpInfo;
dumps.TryAdd(bundleId, dict);
if (!dumps.ContainsKey(bundleId)) dumps[bundleId] = new ConcurrentDictionary<string, DumpMetainfo>();
dumps[bundleId][dumpId] = dumpInfo;
storage.Create(dumpInfo.Id);

FileInfo destFile = await storage.AddFileCopy(dumpInfo.Id, sourcePath);
Expand Down

0 comments on commit b555d24

Please sign in to comment.