This application relates to the field of diagnostic task scheduling technology, and discloses a diagnostic task scheduling method, apparatus, electronic device, and storage medium. The method includes: real-time monitoring of the number of diagnostic requests waiting to be sent in an asynchronous protocol
queue, and adaptively switching the sending mode based on a comparison of this number with a threshold. When the number of requests in the
queue is small, an immediate single-send mode is used, and the scheduling thread is not blocked during the waiting interval, instead executing requests from other asynchronous protocol queues, effectively filling the idle
waiting time of the channel. When the number of requests in the
queue accumulates to a large number, a batch burst mode is switched to continuously send multiple requests back-to-back. The beneficial effects of this invention are: the overall
diagnostic scan time is no longer dominated by the linear accumulation of the
response time of a single slowest ECU, shortening the overall
scan time in multi-ECU diagnostic scenarios and improving the task
throughput of the
diagnostic equipment.