-
Notifications
You must be signed in to change notification settings - Fork 21
Jobs.Common helpers for NuGet.Services.Sql #505
Conversation
return c; | ||
} | ||
} | ||
} |
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.
Dead code, since NuGet.Services.Sql
was introduced
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.
👏
src/NuGet.Jobs.Common/JobBase.cs
Outdated
|
||
internal static string GetDatabaseKey<T>() | ||
{ | ||
return typeof(T).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.
@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) |
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.
I don't understand how this "fails fast". Isn't the failure swallowed into a log?
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.
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?
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.
Updated to really fail fast. Will retry on job restart, and hopefully we can add heartbeat in future to detect startup failures.
d41763d
to
10561f4
Compare
Work towards stabilization of SQL AAD connections for jobs
This is stripped down version of original PR: #485
NuGet.Services.Sql
Next steps: