예제 #1
0
파일: Fluent.cs 프로젝트: addd45/netdaemon
        /// <inheritdoc/>
        async Task IScript.ExecuteAsync()
        {
            var taskList = new List <Task>();

            foreach (var scriptName in EntityIds)
            {
                var task = Daemon.CallService("script", scriptName);
                taskList.Add(task);
            }

            // Wait for all tasks to complete or max 5 seconds
            if (taskList.Count > 0)
            {
                await Task.WhenAny(Task.WhenAll(taskList.ToArray()), Task.Delay(5000)).ConfigureAwait(false);
            }
        }