Browse Source

Fix bug of re-consumption button execution from Dashboard. #525

master
Savorboard 4 years ago
parent
commit
1af7c7770d
3 changed files with 6 additions and 6 deletions
  1. +2
    -2
      src/DotNetCore.CAP.MySql/IMonitoringApi.MySql.cs
  2. +2
    -2
      src/DotNetCore.CAP.PostgreSql/IMonitoringApi.PostgreSql.cs
  3. +2
    -2
      src/DotNetCore.CAP.SqlServer/IMonitoringApi.SqlServer.cs

+ 2
- 2
src/DotNetCore.CAP.MySql/IMonitoringApi.MySql.cs View File

@@ -197,7 +197,7 @@ select aggr.* from (


public async Task<MediumMessage> GetPublishedMessageAsync(long id) public async Task<MediumMessage> GetPublishedMessageAsync(long id)
{ {
var sql = $@"SELECT * FROM `{_pubName}` WHERE `Id`={id};";
var sql = $@"SELECT `Id` as DbId, `Content`,`Added`,`ExpiresAt`,`Retries` FROM `{_pubName}` WHERE `Id`={id};";


await using var connection = new MySqlConnection(_options.Value.ConnectionString); await using var connection = new MySqlConnection(_options.Value.ConnectionString);
return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql); return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql);
@@ -205,7 +205,7 @@ select aggr.* from (


public async Task<MediumMessage> GetReceivedMessageAsync(long id) public async Task<MediumMessage> GetReceivedMessageAsync(long id)
{ {
var sql = $@"SELECT * FROM `{_recName}` WHERE Id={id};";
var sql = $@"SELECT `Id` as DbId, `Content`,`Added`,`ExpiresAt`,`Retries` FROM `{_recName}` WHERE Id={id};";
await using var connection = new MySqlConnection(_options.Value.ConnectionString); await using var connection = new MySqlConnection(_options.Value.ConnectionString);
return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql); return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql);
} }


+ 2
- 2
src/DotNetCore.CAP.PostgreSql/IMonitoringApi.PostgreSql.cs View File

@@ -32,7 +32,7 @@ namespace DotNetCore.CAP.PostgreSql
public async Task<MediumMessage> GetPublishedMessageAsync(long id) public async Task<MediumMessage> GetPublishedMessageAsync(long id)
{ {
var sql = var sql =
$"SELECT * FROM {_pubName} WHERE \"Id\"={id} FOR UPDATE SKIP LOCKED";
$"SELECT \"Id\" AS \"DbId\",* FROM {_pubName} WHERE \"Id\"={id} FOR UPDATE SKIP LOCKED";


using var connection = new NpgsqlConnection(_options.Value.ConnectionString); using var connection = new NpgsqlConnection(_options.Value.ConnectionString);
return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql); return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql);
@@ -41,7 +41,7 @@ namespace DotNetCore.CAP.PostgreSql
public async Task<MediumMessage> GetReceivedMessageAsync(long id) public async Task<MediumMessage> GetReceivedMessageAsync(long id)
{ {
var sql = var sql =
$"SELECT * FROM {_recName} WHERE \"Id\"={id} FOR UPDATE SKIP LOCKED";
$"SELECT \"Id\" AS \"DbId\",* FROM {_recName} WHERE \"Id\"={id} FOR UPDATE SKIP LOCKED";
using var connection = new NpgsqlConnection(_options.Value.ConnectionString); using var connection = new NpgsqlConnection(_options.Value.ConnectionString);
return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql); return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql);
} }


+ 2
- 2
src/DotNetCore.CAP.SqlServer/IMonitoringApi.SqlServer.cs View File

@@ -124,14 +124,14 @@ select count(Id) from {_recName} with (nolock) where StatusName = N'Failed';";


public async Task<MediumMessage> GetPublishedMessageAsync(long id) public async Task<MediumMessage> GetPublishedMessageAsync(long id)
{ {
var sql = $@"SELECT * FROM {_pubName} WITH (readpast) WHERE Id={id}";
var sql = $@"SELECT Id as DbId, * FROM {_pubName} WITH (readpast) WHERE Id={id}";
using var connection = new SqlConnection(_options.ConnectionString); using var connection = new SqlConnection(_options.ConnectionString);
return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql); return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql);
} }


public async Task<MediumMessage> GetReceivedMessageAsync(long id) public async Task<MediumMessage> GetReceivedMessageAsync(long id)
{ {
var sql = $@"SELECT * FROM {_recName} WITH (readpast) WHERE Id={id}";
var sql = $@"SELECT Id as DbId,* FROM {_recName} WITH (readpast) WHERE Id={id}";
using var connection = new SqlConnection(_options.ConnectionString); using var connection = new SqlConnection(_options.ConnectionString);
return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql); return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql);
} }


Loading…
Cancel
Save