Hi welcome to ERPNext,
To start there’s this Running Background Jobs
As well a search on ‘background’ plus ‘report’ ‘worker’ ‘scheduler’ will help inform you for eg Functions executed in background often gets stale document from frappe.get_doc/reload
have fun