Browse Source

增加多线程超时控制

master
zhouhongjun 6 months ago
parent
commit
3ff8bc8bbe
  1. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs
  2. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs
  3. 2
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs
  4. 2
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSBJBMPTDbContext.cs

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs

@ -140,7 +140,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
var jobItem = this.GetJobItem(job.Id); var jobItem = this.GetJobItem(job.Id);
Guid? jobLogId = null; Guid? jobLogId = null;
// 如果作业正在运行并且心跳超过120分钟,则停止作业 // 如果作业正在运行并且心跳超过20秒,则停止作业
if (jobItem.IsRunning && (DateTime.Now - jobItem.HeartBeat.Value).TotalMinutes > 120) if (jobItem.IsRunning && (DateTime.Now - jobItem.HeartBeat.Value).TotalMinutes > 120)
{ {
JobItemStop(jobItem.Id); JobItemStop(jobItem.Id);

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs

@ -94,7 +94,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
//业务类别 //业务类别
var businessType = SeSyncConfigInfo.BusinessType; var businessType = SeSyncConfigInfo.BusinessType;
var seed = 0; var seed = 0;
while (seed < 10) while (seed < 6)
{ {
seed++; seed++;
var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false); var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
@ -105,7 +105,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
.Where(t => t.UID > int.Parse(syncPosition)) .Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType) .Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType)) .Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(1_000).ToList(); .OrderBy(b => b.UID).Take(5000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords); var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any()) if (jisSeDetails.Any())
{ {
@ -136,7 +136,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
//业务类别 //业务类别
var businessType = SeSyncConfigInfo.BusinessType; var businessType = SeSyncConfigInfo.BusinessType;
var seed = 0; var seed = 0;
while (seed < 10) while (seed < 6)
{ {
seed++; seed++;
var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false); var syncPositionFlag = await _settleAccountDbContext.Set<SyncPositionFlag>().FirstOrDefaultAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
@ -147,7 +147,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
.Where(t => t.UID > int.Parse(syncPosition)) .Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType) .Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType)) .Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(1_000).ToList(); .OrderBy(b => b.UID).Take(5000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords); var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any()) if (jisSeDetails.Any())
{ {

2
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs

@ -15,7 +15,7 @@ namespace Win.Sfs.SettleAccount.EntityFrameworkCore
public ExChangeCenterDbContext(DbContextOptions<ExChangeCenterDbContext> options) : base(options) public ExChangeCenterDbContext(DbContextOptions<ExChangeCenterDbContext> options) : base(options)
{ {
this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(50)); //this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(50));
} }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)

2
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSBJBMPTDbContext.cs

@ -17,7 +17,7 @@ namespace Win.Sfs.SettleAccount.EntityFrameworkCore
public WMSBJBMPTDbContext(DbContextOptions<WMSBJBMPTDbContext> options) : base(options) public WMSBJBMPTDbContext(DbContextOptions<WMSBJBMPTDbContext> options) : base(options)
{ {
this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(50)); //this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(50));
} }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)

Loading…
Cancel
Save