Skip to content

Commit

Permalink
Merge pull request #307 from cmu-sei/v8
Browse files Browse the repository at this point in the history
V8
  • Loading branch information
sei-dupdyke authored Apr 2, 2024
2 parents c2a7395 + 4abf67e commit a46d12e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
17 changes: 0 additions & 17 deletions src/Ghosts.Api/Infrastructure/Services/QueueSyncService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ private async void Run()
{
while (true)
{
_log.Trace("Beginning sync loop...");

try
{
await Sync();
Expand All @@ -62,8 +60,6 @@ private async void Run()
_log.Error(ex);
}

_log.Trace("Ending sync loop");

await Task.Delay(new TimeSpan(0, 0, Program.ApplicationSettings.QueueSyncDelayInSeconds));
}
}
Expand Down Expand Up @@ -111,8 +107,6 @@ private async Task ProcessNotification(ApplicationDbContext context, Notificatio

try
{
_log.Trace($"Attempting find for {item}");

foreach (var webhook in webhooks)
{
var t = new Thread(() => { HandleWebhook(webhook, item); }) { IsBackground = true };
Expand All @@ -132,8 +126,6 @@ private async Task ProcessMachine(IServiceScope scope, ApplicationDbContext cont
{
var service = scope.ServiceProvider.GetRequiredService<IMachineService>();

_log.Trace("Scope and context created");

var machines = new List<Machine>();
var histories = new List<Machine.MachineHistoryItem>();
var timelines = new List<HistoryTimeline>();
Expand All @@ -142,27 +134,20 @@ private async Task ProcessMachine(IServiceScope scope, ApplicationDbContext cont

//clients can send up a "create webhook" payload
var webhooks = new List<Webhook>();

_log.Trace("Beginning item processing...");

_log.Trace($"Attempting find for {item.Machine.Id}");
Machine machine = null;

if (item.Machine.Id != Guid.Empty)
machine = context.Machines.FirstOrDefault(o => o.Id == item.Machine.Id);

if (machine == null)
{
_log.Trace("Machine not found by id");
if (!string.IsNullOrEmpty(item.Machine.Name))
{
_log.Trace($"Searching for machine by name {item.Machine.Name}");
machine = context.Machines.FirstOrDefault(o => o.Name == item.Machine.Name);
}

if (machine == null)
{
_log.Trace("Machine is still null, so attempting another create");
if (item.Machine.Id == Guid.Empty)
item.Machine.Id = Guid.NewGuid();
item.Machine.LastReportedUtc = DateTime.UtcNow;
Expand All @@ -187,8 +172,6 @@ private async Task ProcessMachine(IServiceScope scope, ApplicationDbContext cont
CreatedUtc = DateTime.UtcNow
});

_log.Trace($"Proc history type: {item.HistoryType}");

if (item.HistoryType == Machine.MachineHistoryItem.HistoryType.PostedResults)
{
if (item.LogDump.Log.Length > 0)
Expand Down
2 changes: 1 addition & 1 deletion src/Ghosts.Api/ghosts.api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>ghosts.api</AssemblyName>

<AssemblyVersion>8.0.0.0</AssemblyVersion>
<FileVersion>8.0.7.50</FileVersion>
<FileVersion>8.0.7.65</FileVersion>

<Authors>GHOSTS Development Squad for CERT > Software Engineering Institute > Carnegie Mellon University</Authors>
<Company>Carnegie Mellon University</Company>
Expand Down

0 comments on commit a46d12e

Please sign in to comment.