Use consistent hostname in display and processor

Previously, the hostname written to the console and the hostname used
for the ChangeFeedProcessor were different. The console was the string
"hostName" with a timestamp. The ChangeFeedProcessor used a GUID.

Now, both use a value based on the current machine's name with a
timestamp, like "MY-MACHINE@636693244993023673".
This commit is contained in:
Christopher Warrington 2018-08-08 11:32:09 -07:00
Родитель be448190a2
Коммит 03488e8e38
1 изменённых файлов: 2 добавлений и 6 удалений

Просмотреть файл

@ -41,6 +41,8 @@ namespace ChangeFeedProcessor
private string leaseCollectionName = ConfigurationManager.AppSettings["leaseCollectionName"];
private int leaseThroughput = int.Parse(ConfigurationManager.AppSettings["leaseThroughput"]);
private static string hostName = Environment.MachineName + "@" + DateTime.Now.Ticks.ToString();
private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
/// <summary>
@ -50,8 +52,6 @@ namespace ChangeFeedProcessor
///
public static void Main(string[] args)
{
string hostName = "HostName " + DateTime.Now.Ticks.ToString();
if (args.Length == 1)
{
hostName = args[0];
@ -106,8 +106,6 @@ namespace ChangeFeedProcessor
public async Task RunChangeFeedHostAsync()
{
string hostName = Guid.NewGuid().ToString();
// monitored collection info
DocumentCollectionInfo documentCollectionInfo = new DocumentCollectionInfo
{
@ -117,7 +115,6 @@ namespace ChangeFeedProcessor
CollectionName = this.monitoredCollectionName
};
DocumentCollectionInfo leaseCollectionInfo = new DocumentCollectionInfo
{
Uri = new Uri(this.leaseUri),
@ -148,7 +145,6 @@ namespace ChangeFeedProcessor
await result.StopAsync();
}
/// <summary>
/// Checks whether a collections exists. Creates a new collection if
/// the collection does not exist.