Open Closed

CreateAsync in CRUD-Service runs into timeout whe writing into two different repositories #7602


User avatar
0
Steffen_Schoen created
  • ABP Framework version: v8.0.5
  • UI Type: Angular
  • Database System: EF Core MySQL
  • Exception message and full stack trace: No Exception, angular runs into timeout
  • Steps to reproduce the issue: CreateAsync in Crud-Service, write into different repositories

Hi, we have a CRUD-Service looking like this

 [Authorize(SeoMonitorPermissions.MonitorBlocks.Default)]
    public class MonitorBlockAppService :
    CrudAppService<
        MonitorBlockItem, 
        MonitorBlockItemDto, 
        Guid, 
        MonitorBlockPagedSortedFilteredRequestDto, 
        CreateUpdateMonitorBlockItemDto>, 
    IMonitorBlockAppService //implement the IMonitorBlockAppService
    {
        private readonly IRepository<MonitorBoardItem, Guid> _monitorBoardItemRepository;
        private readonly IRepository<MonitorBlockItem, Guid> _monitorBlockItemRepository;
        private readonly IRepository<MonitorBlockItemAssignment, Guid> _monitorBlockItemAssignmentRepository;
        private readonly IRepository<WebsiteItem, Guid> _websitesRepository;
        private readonly IRepository<JobItem, Guid> _jobsRepository;

        //private MonitorBlockManager monitorBlockManger;

        public MonitorBlockAppService(IRepository<MonitorBlockItem, Guid> repository,
             IRepository<MonitorBoardItem, Guid> monitorBoardItemRepository,
             IRepository<MonitorBlockItemAssignment, Guid> monitorBlockItemAssignmentRepository,
             IRepository<WebsiteItem, Guid> websitesRepository,
             IRepository<JobItem, Guid> jobsRepository
            )
            : base(repository)
            {
            _monitorBoardItemRepository = monitorBoardItemRepository;
            _monitorBlockItemRepository = repository;
            _monitorBlockItemAssignmentRepository = monitorBlockItemAssignmentRepository;
            _websitesRepository = websitesRepository;
            _jobsRepository = jobsRepository;
            }

inside there is a CreateAsync-Endpoint looking like this:

        [UnitOfWork]
        public override async Task<MonitorBlockItemDto> CreateAsync(CreateUpdateMonitorBlockItemDto input)
        {
            //Create MonitorBlockItem
            var currentBlock = await base.CreateAsync(input);

            Logger.LogInformation("MonitorBlockServce: Start Writing Assingnements");
            try
            {
                //writing 1:n relations
                var blockSiteAssignements = new List<MonitorBlockItemAssignment>();
        
                foreach (var job in input.AssignedJobs)
                {
                    var assignement = new MonitorBlockItemAssignment(job.Id, currentBlock.Id);
                    blockSiteAssignements.Add(assignement);
                }
               // await _monitorBlockItemAssignmentRepository.InsertManyAsync(blockSiteAssignements);
            }
            catch (Exception ex) {
                Logger.LogException(ex);
                throw ex;
            }

            Logger.LogInformation("MonitorBlockService:  Assingnements written");
            Logger.LogInformation("MonitorBlockService: returning Block");

            return currentBlock;
        }

When we call this endpoint from angular, the request never finsihes. But if we set a breakpoint to " return currentBlock;" it is reached with nearly no delay.

We assume it has something to do with writing into two different repositories within one endpoint call.

How do i fix this behaviour ?

best regards, Steffen Schön


1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    HI,

    I see many log out, What's the log result?

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 01, 2025, 08:37