mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 05:28:15 -05:00
db maintenance function
This commit is contained in:
parent
c0cce5a466
commit
f18e517b1a
@ -10,9 +10,9 @@ namespace Bit.Function
|
|||||||
public static class DatabaseMaintenance
|
public static class DatabaseMaintenance
|
||||||
{
|
{
|
||||||
[FunctionName("DatabaseMaintenance")]
|
[FunctionName("DatabaseMaintenance")]
|
||||||
public static void Run([TimerTrigger("0 0 * * *")]TimerInfo myTimer, TraceWriter log)
|
public static void Run([TimerTrigger("0 0 4 * * *")]TimerInfo myTimer, TraceWriter log)
|
||||||
{
|
{
|
||||||
var connectionString = ConfigurationManager.ConnectionStrings["vault_db"].ConnectionString;
|
var connectionString = ConfigurationManager.ConnectionStrings["Vault"].ConnectionString;
|
||||||
using(var connection = new SqlConnection(connectionString))
|
using(var connection = new SqlConnection(connectionString))
|
||||||
{
|
{
|
||||||
connection.Open();
|
connection.Open();
|
||||||
@ -33,6 +33,8 @@ namespace Bit.Function
|
|||||||
// Asynchronous BeginExecuteNonQuery for this long running sproc to avoid timeouts
|
// Asynchronous BeginExecuteNonQuery for this long running sproc to avoid timeouts
|
||||||
var result = cmd.BeginExecuteNonQuery();
|
var result = cmd.BeginExecuteNonQuery();
|
||||||
cmd.EndExecuteNonQuery(result);
|
cmd.EndExecuteNonQuery(result);
|
||||||
|
|
||||||
|
log.Info($"Started [dbo].[AzureSQLMaintenance] at {DateTime.UtcNow}.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user