Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

Add Vostok.Hosting #37

Merged
merged 12 commits into from
Nov 27, 2017
Merged

Add Vostok.Hosting #37

merged 12 commits into from
Nov 27, 2017

Conversation

spaceorc
Copy link
Contributor

@spaceorc spaceorc commented Nov 2, 2017

No description provided.

}
catch (Exception e)
{
return new VostokHost(hostingEnvironment, async _ => throw new AggregateException("Failed to build host", e));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

решарпер ругается, что будет запускаться синхронно, не найдены await-операторы

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не обращай внимания и все

Copy link
Contributor

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>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не понятен смысл использования в данном месте AsyncLocal

Copy link
Contributor Author

@spaceorc spaceorc Nov 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как раз так и задумано. Каждый новый VostokHost, созданный через билдер будет иметь свой экземпляр hostingEnvironment.Current, и к нему можно будет обращаться из сервисов. Это надо, например, чтобы в тестах создавать несколько хостов в одном процессе.

startTcs.SetException(e);
return;
}
HostingEnvironment.HostLog.Info(shutdownMessage ?? "Service started");
Copy link
Contributor

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}");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может использовать airlockSection.Path вместо строки vostok.airlock?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants