-
Notifications
You must be signed in to change notification settings - Fork 2
Add Vostok.Hosting #37
Conversation
Vostok.Hosting/VostokHostBuilder.cs
Outdated
} | ||
catch (Exception e) | ||
{ | ||
return new VostokHost(hostingEnvironment, async _ => throw new AggregateException("Failed to build host", e)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
решарпер ругается, что будет запускаться синхронно, не найдены await-операторы
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не обращай внимания и все
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
почему нельзя удалить слово async?
{ | ||
public class VostokHostingEnvironment : IVostokHostingEnvironment | ||
{ | ||
private static readonly AsyncLocal<IVostokHostingEnvironment> hostingEnvironmentContainer = new AsyncLocal<IVostokHostingEnvironment>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не понятен смысл использования в данном месте AsyncLocal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как раз так и задумано. Каждый новый VostokHost, созданный через билдер будет иметь свой экземпляр hostingEnvironment.Current, и к нему можно будет обращаться из сервисов. Это надо, например, чтобы в тестах создавать несколько хостов в одном процессе.
Vostok.Hosting/VostokHost.cs
Outdated
startTcs.SetException(e); | ||
return; | ||
} | ||
HostingEnvironment.HostLog.Info(shutdownMessage ?? "Service started"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Service started" как-то не соответствует понятию shutdownMessage
else if (propertyInfo.PropertyType == typeof (int)) | ||
{ | ||
if (!int.TryParse(value, out var intValue)) | ||
throw new InvalidOperationException($"Invalid value '{value}' for vostok.airlock.{propertyInfo.Name}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Может использовать airlockSection.Path вместо строки vostok.airlock?
No description provided.