Running a method with a loop in hangfire

I was needing some advice on how to run a method that has a loop and some complex logic in it as a hangfire fire-and-forget task.

My question is: I know how to run a fire-and-forget task in hangfire , but wasn’t sure if the method below would be a good candidate for a task in hangfire.?

I could simply use this call: BackgroundJob.Enqueue(() => SaveMembers(selectedChildMembers)) but I am not sure how hangfire will retry it, and whether it will retry it in case the loop in the method failed in the middle.

      public void SaveMembers ( List<ChildMember> selectedChildMembers)
        {
        
          foreach (ChildMember member in selectedChildMembers)
              {
        
                 DAL.UpdateChildMember(member);//database call
                 DAL.UpdateTiers(member); //database call
                      
                foreach(Tier tier in member.Tiers)
                   {
                      //database call
                       DAL.UpdateTierHistory( tier, member.MemberID); 
                   }
                 //sends out an emai
                  Email.SendNotification(member.EmailAddress);l
         
        }
    
    }
 
}

All long-running methods are good candidates for Hangfire. However it will retry the whole loop in case of different circumstances (app domain unload timeout, process termination, etc). You should wrap the whole method within a transaction. By the way, methods with loops are good candidates to use Hangfire’s cancellation tokens to lower the application shutdown time:

public void SomeMethod(IJobCancellationToken cancellationToken)
{
    while (true)
    {
        cancellationToken.ThrowIfCancellationRequested();
    }
}