Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Delete pool queue when pool is deleted #2431

Merged
merged 3 commits into from
Sep 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/ApiService/ApiService/onefuzzlib/PoolOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ public async Async.Task<Pool> Init(Pool pool) {
if (!r.IsOk) {
_logTracer.Error($"Failed to delete pool: {pool.Name} due to {r.ErrorV}");
}
var poolQueue = GetPoolQueue(pool.PoolId);
await _context.Queue.DeleteQueue(poolQueue, StorageType.Corpus);

var shrinkQueue = new ShrinkQueue(pool.PoolId, _context.Queue, _logTracer);
await shrinkQueue.Delete();

await _context.Events.SendEvent(new EventPoolDeleted(PoolName: pool.Name));
}

Expand Down Expand Up @@ -209,10 +215,6 @@ public async Async.Task<Pool> Halt(Pool pool) {
var nodes = _context.NodeOperations.SearchByPoolName(pool.Name);

if (scalesets is null && nodes is null) {
var poolQueue = GetPoolQueue(pool.PoolId);
await _context.Queue.DeleteQueue(poolQueue, StorageType.Corpus);
var shrinkQueue = new ShrinkQueue(pool.PoolId, _context.Queue, _logTracer);
await shrinkQueue.Delete();
_logTracer.Info($"pool stopped, deleting: {pool.Name}");
await Delete(pool);
}
Expand Down