Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
aneojgurhem committed Nov 12, 2024
1 parent 41a7393 commit c677b7e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Common/src/Pollster/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -265,7 +266,7 @@ public async Task<ICollection<Result>> CreateResults(string
{
ThrowIfInvalidToken(token);

var local = new Dictionary<string, (byte[] id, long size)>();
var local = new ConcurrentDictionary<string, (byte[] id, long size)>();

var results = await requests.Select(async rc =>
{
Expand All @@ -279,8 +280,7 @@ public async Task<ICollection<Result>> CreateResults(string
cancellationToken)
.ConfigureAwait(false);
local.Add(resultId,
add);
local[resultId] = add;
return new Result(rc.request.SessionId,
resultId,
Expand Down
2 changes: 1 addition & 1 deletion Common/src/Pollster/DataPrefetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public async Task PrefetchDataAsync(TaskData taskData,
};
dependencies.AddRange(taskData.DataDependencies);


//use find here
var ids = await resultTable_.GetResults(taskData.SessionId,
dependencies,
cancellationToken)
Expand Down
2 changes: 2 additions & 0 deletions Common/src/Storage/ResultLifeCycleHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ public static async Task PurgeResultsAsync(IResultTable resultTable,
string sessionId,
CancellationToken cancellationToken)
{
// todo: have a better check here in the case we want to support data created by old storages
// I think we should make db migrations !
await foreach (var ids in resultTable.GetResults(result => result.SessionId == sessionId && result.OpaqueId.Length > 0,
result => result.OpaqueId,
cancellationToken)
Expand Down

0 comments on commit c677b7e

Please sign in to comment.