Coordinator can't stop in time, because of background jobs are still running
- Dominant language
- Go
- Stars
- 1.2k
- Forks
- 783
- Avg merge
- 5d 21h
- Merged PRs (30d)
- 36
Description
## Bug Report
I have posted a post on the forum, see https://asktug.com/t/topic/694191/3 .
In short, the problem is that when coordinator is stopping the scheduler will still keep running until all jobs are finished.
The following figure shows that it takes a long time for the coordinator to close from the beginning to the end, in this case more than 10 minutes.

I think the root cause is that schedulers and other background jobs have no way to receive the signal to exit when coordinator is stopping.
### What did you do?
pd leader lease timeout.

### What did you expect to see?
Follower campaign for leader in time.
### What did you see instead?
Follower can't campaign for leader in 10 minutes, and keep print the following log.

### What version of PD are you using (`pd-server -V`)?
5.3.0
Contributor guide
Assessment
This issue has not been assessed yet.