Skip to content

Commit

Permalink
Get container info from FactoryOS registry instead of cmdiag; Create …
Browse files Browse the repository at this point in the history
…service events for container status (#20)

* Get container info from FactoryOS registry instead of cmdiag; Create service events for container status
  • Loading branch information
spaceisfun authored and hajya committed Oct 15, 2020
1 parent be76557 commit 18f5c86
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 110 deletions.
29 changes: 7 additions & 22 deletions src/App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,28 +433,6 @@ public void OnIpcConnected()
await Task.Delay(1000);
}
});


Task.Run(async () =>
{
while (true)
{
try
{
IsContainerRunning = await Client.IsContainerRunning();
}
catch (FactoryOrchestratorConnectionException)
{
OnConnectionFailure();
while (OnConnectionPage || (!Client.IsConnected))
{
await Task.Delay(1000);
}
}

await Task.Delay(10000);
}
});
}
}

Expand Down Expand Up @@ -546,8 +524,15 @@ private async Task HandleServiceEvents()
await HandleExternalTaskRunAsync(run);
}
}
break;
case ServiceEventType.ContainerConnected:
IsContainerRunning = true;
break;
case ServiceEventType.ContainerDisconnected:
IsContainerRunning = false;
break;
default:
// Ignore other events
break;
}
}
Expand Down
16 changes: 12 additions & 4 deletions src/CoreLibrary/IPCInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,27 @@ public enum ServiceEventType
/// </summary>
WaitingForContainerTaskRun,
/// <summary>
/// The Factory Orchestrator Serivce threw an exception.
/// The Factory Orchestrator Service threw an exception.
/// </summary>
ServiceError,
/// <summary>
/// The Factory Orchestrator Serivce is starting. It can now communicate with clients, but boot tasks may not be complete.
/// The Factory Orchestrator Service is starting. It can now communicate with clients, but boot tasks may not be complete.
/// </summary>
ServiceStart,
/// <summary>
/// The Factory Orchestrator Serivce is fully started. Boot tasks are completed.
/// The Factory Orchestrator Service is fully started. Boot tasks are completed.
/// </summary>
BootTasksComplete,
/// <summary>
/// An unknown Factory Orchestrator Serivce event occurred.
/// The Factory Orchestrator Service is connected to a container also running a compatible version of Factory Orchestrator Service.
/// </summary>
ContainerConnected,
/// <summary>
/// The Factory Orchestrator Service is disconnected from a container also running a compatible version of Factory Orchestrator Service.
/// </summary>
ContainerDisconnected,
/// <summary>
/// An unknown Factory Orchestrator Service event occurred.
/// </summary>
Unknown = int.MaxValue
}
Expand Down
18 changes: 18 additions & 0 deletions src/CoreLibrary/Resources/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/CoreLibrary/Resources/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -423,4 +423,12 @@
<data name="DuplicateGuidInXml" xml:space="preserve">
<value>Duplicate Guid(s) {0}in FactoryOrchestratorXML!</value>
</data>
<data name="ContainerConnected" xml:space="preserve">
<value>Factory Orchestrator Service is connected to a container running a compatible version of Factory Orchestrator Service.</value>
<comment>container refers to a Windows container running on the host device (eg https://docs.microsoft.com/en-us/virtualization/windowscontainers/about/)</comment>
</data>
<data name="ContainerDisconnected" xml:space="preserve">
<value>Factory Orchestrator Service is disconnected from a container running a compatible version of Factory Orchestrator Service.</value>
<comment>container refers to a Windows container running on the host device (eg https://docs.microsoft.com/en-us/virtualization/windowscontainers/about/)</comment>
</data>
</root>
Loading

0 comments on commit 18f5c86

Please sign in to comment.