c# – Strategy for Chrome timing out on a Database cleanup job which takes a long time

I have a notifications app which sends users notifications. It uses a .NET core backend, an angular frontend and Cosmos DB. Within this I have an API endpoint function which is linked to a button used to clean up inactive users’ records from the DB based on a selected time period.
This database job takes a long time to complete (up to 30 minutes) and is a problem because chrome’s maximum time out limit is only 5 minutes. This prevents a “Success, users deleted” message from showing up on the client side. What strategy or workaround can I use to avoid this problem?

API Endpoint

        (HttpDelete("CleanUpInactiveUsers/{years}"))
        public async Task<IActionResult> CleanUpInactiveUsers(string years)
        {
            try
            {
                await Queries.RemoveInactiveUsers(years);
                return Ok($"Users inactive for more than {years} have been deleted");
            }
            catch (Exception ex)
            {
                return StatusCode((int)HttpStatusCode.InternalServerError);
            }
        }

Frontend call

// getUsersWithCondition(args) returns the total number of users if args="All", 
// otherwise return no. of users who haven't been active for more than args=<years>
// deleteInactiveUsers() linked with API endpoint snippet above.
.
.
.
            case this.TaskEnum.CleanInactiveUsers:{

              this._apiService.showToast(true, 'Clean Up of inactive users has begun. You will be notified once completed.');

              this._apiService.getUsersWithCondition(item.Params('time')).subscribe((response:string) =>
              {
                this.finalCount = Number(response);
              });

              this._apiService.deleteInactiveUsers(item.Params('time')).toPromise().then(res =>
                {
                    this._apiService.showToast(true, 'Deleted '+ this.finalCount + ' User(s)');
                }
              ).catch((error) => EpDialogService.error({message: 'In App Notification', description: `An error ocurred while executing the task ${ item.Task }`}));
              break;
            }