From 3badbaf364940335e1d1e0c4ac343d68644792f8 Mon Sep 17 00:00:00 2001 From: Elvin Morales Date: Mon, 19 Nov 2018 15:23:38 -0800 Subject: [PATCH] Fix retry logic for deployment not seeding correctly --- config/Services/Seed.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/config/Services/Seed.cs b/config/Services/Seed.cs index 6c6f039..d5c229c 100644 --- a/config/Services/Seed.cs +++ b/config/Services/Seed.cs @@ -74,12 +74,17 @@ namespace Microsoft.Azure.IoTSolutions.UIConfig.Services } this.log.Info("Seed begin", () => { }); - await this.SeedAsync(); - this.log.Info("Seed end", () => { }); - - await this.SetCompletedFlagAsync(); - - await this.mutex.LeaveAsync(SEED_COLLECTION_ID, MUTEX_KEY); + try + { + await this.SeedAsync(); + this.log.Info("Seed end", () => { }); + await this.SetCompletedFlagAsync(); + this.log.Info("Seed completed flag set", () => { }); + } + finally + { + await this.mutex.LeaveAsync(SEED_COLLECTION_ID, MUTEX_KEY); + } } private async Task CheckCompletedFlagAsync()