Browse Source

Fixed DateTime localization format conversion error to sql.(#139)

master
Savorboard 6 years ago
parent
commit
9caf7a2308
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs
  2. +1
    -1
      src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageConnection.cs
  3. +1
    -1
      src/DotNetCore.CAP.SqlServer/SqlServerStorageConnection.cs

+ 1
- 1
src/DotNetCore.CAP.MySql/MySqlStorageConnection.cs View File

@@ -80,7 +80,7 @@ VALUES(@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);SELECT LAST


public async Task<IEnumerable<CapReceivedMessage>> GetReceivedMessagesOfNeedRetry() public async Task<IEnumerable<CapReceivedMessage>> GetReceivedMessagesOfNeedRetry()
{ {
var fourMinsAgo = DateTime.Now.AddMinutes(-4);
var fourMinsAgo = DateTime.Now.AddMinutes(-4).ToString("O");
var sql = var sql =
$"SELECT * FROM `{_prefix}.received` WHERE `Retries`<{_capOptions.FailedRetryCount} AND `Added`<'{fourMinsAgo}' AND (`StatusName` = '{StatusName.Failed}' OR `StatusName` = '{StatusName.Scheduled}') LIMIT 200;"; $"SELECT * FROM `{_prefix}.received` WHERE `Retries`<{_capOptions.FailedRetryCount} AND `Added`<'{fourMinsAgo}' AND (`StatusName` = '{StatusName.Failed}' OR `StatusName` = '{StatusName.Scheduled}') LIMIT 200;";
using (var connection = new MySqlConnection(Options.ConnectionString)) using (var connection = new MySqlConnection(Options.ConnectionString))


+ 1
- 1
src/DotNetCore.CAP.PostgreSql/PostgreSqlStorageConnection.cs View File

@@ -77,7 +77,7 @@ namespace DotNetCore.CAP.PostgreSql


public async Task<IEnumerable<CapReceivedMessage>> GetReceivedMessagesOfNeedRetry() public async Task<IEnumerable<CapReceivedMessage>> GetReceivedMessagesOfNeedRetry()
{ {
var fourMinsAgo = DateTime.Now.AddMinutes(-4);
var fourMinsAgo = DateTime.Now.AddMinutes(-4).ToString("O");
var sql = var sql =
$"SELECT * FROM \"{Options.Schema}\".\"received\" WHERE \"Retries\"<{_capOptions.FailedRetryCount} AND \"Added\"<'{fourMinsAgo}' AND (\"StatusName\"='{StatusName.Failed}' OR \"StatusName\"='{StatusName.Scheduled}') LIMIT 200;"; $"SELECT * FROM \"{Options.Schema}\".\"received\" WHERE \"Retries\"<{_capOptions.FailedRetryCount} AND \"Added\"<'{fourMinsAgo}' AND (\"StatusName\"='{StatusName.Failed}' OR \"StatusName\"='{StatusName.Scheduled}') LIMIT 200;";
using (var connection = new NpgsqlConnection(Options.ConnectionString)) using (var connection = new NpgsqlConnection(Options.ConnectionString))


+ 1
- 1
src/DotNetCore.CAP.SqlServer/SqlServerStorageConnection.cs View File

@@ -40,7 +40,7 @@ namespace DotNetCore.CAP.SqlServer


public async Task<IEnumerable<CapPublishedMessage>> GetPublishedMessagesOfNeedRetry() public async Task<IEnumerable<CapPublishedMessage>> GetPublishedMessagesOfNeedRetry()
{ {
var fourMinsAgo = DateTime.Now.AddMinutes(-4);
var fourMinsAgo = DateTime.Now.AddMinutes(-4).ToString("O");
var sql = var sql =
$"SELECT TOP (200) * FROM [{Options.Schema}].[Published] WITH (readpast) WHERE Retries<{_capOptions.FailedRetryCount} AND Added<'{fourMinsAgo}' AND (StatusName = '{StatusName.Failed}' OR StatusName = '{StatusName.Scheduled}')"; $"SELECT TOP (200) * FROM [{Options.Schema}].[Published] WITH (readpast) WHERE Retries<{_capOptions.FailedRetryCount} AND Added<'{fourMinsAgo}' AND (StatusName = '{StatusName.Failed}' OR StatusName = '{StatusName.Scheduled}')";




Loading…
Cancel
Save