Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.
/ NuGet.Jobs Public archive

Jobs.Common helpers for NuGet.Services.Sql #505

Merged
merged 4 commits into from
Aug 7, 2018
Merged

Conversation

chenriksson
Copy link
Member

@chenriksson chenriksson commented Aug 1, 2018

Work towards stabilization of SQL AAD connections for jobs
This is stripped down version of original PR: #485

  • Updates projects to latest NuGet.Services.Sql
  • Adds NuGet.Services.Sql dependency + helpers to NuGet.Jobs.Common
  • Adds tests for NuGet.Jobs.Common
  • Does NOT update any jobs, aside from dependency update. Should be non-functional w/o config changes.

Next steps:

  • Moving JsonConfigurationJob into NuGet.Jobs.Common, so legacy jobs can use it
  • Updating each individual job, one PR at a time :-)

return c;
}
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Dead code, since NuGet.Services.Sql was introduced

Copy link
Member

Choose a reason for hiding this comment

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

👏


internal static string GetDatabaseKey<T>()
{
return typeof(T).Name;
Copy link
Member Author

Choose a reason for hiding this comment

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

@loic-sharma @agr this was the cause for my earlier regression, and why I needed to revert. I meant to cache on IDbConfiguration type name. Instead, I cached on "T" and only the last db registration persisted.

Fixed and added test.

/// <summary>
/// Test connection early to fail fast, and log connection diagnostics.
/// </summary>
private async Task TestConnection(string name, ISqlConnectionFactory connectionFactory)
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand how this "fails fast". Isn't the failure swallowed into a log?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, "warn fast" is more correct - just wanted a way to verify on startup whether the DB connections are configured correctly.

Maybe I should retry/throw in this case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to really fail fast. Will retry on job restart, and hopefully we can add heartbeat in future to detect startup failures.

@chenriksson chenriksson force-pushed the chenriks-jobscommon-sql branch from d41763d to 10561f4 Compare August 3, 2018 21:58
@chenriksson chenriksson changed the title Jobs.Commons helpers for NuGet.Services.Sql Jobs.Common helpers for NuGet.Services.Sql Aug 4, 2018
@chenriksson chenriksson merged commit 6c451f8 into dev Aug 7, 2018
@chenriksson chenriksson deleted the chenriks-jobscommon-sql branch September 26, 2018 23:29
joelverhagen pushed a commit that referenced this pull request Sep 27, 2019
joelverhagen pushed a commit that referenced this pull request Oct 26, 2020
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.

3 participants