File tree 1 file changed +4
-1
lines changed
crates/rspack_core/src/utils 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ pub trait Task<Ctx>: Debug + Send + Any + AsAny {
54
54
struct TaskLoop < Ctx > {
55
55
/// Main tasks run sequentially in the queue
56
56
main_task_queue : VecDeque < Box < dyn Task < Ctx > > > ,
57
- /// The count of the running background tasks which run immediately in tokio thread workers when they are returnt
57
+ /// The count of the running background tasks which run immediately in tokio thread workers when they are returned
58
58
background_task_count : u32 ,
59
59
/// Mark whether the task loop has been returned.
60
60
/// The async task should not call `tx.send` after this mark to true
@@ -88,10 +88,13 @@ impl<Ctx: 'static> TaskLoop<Ctx> {
88
88
89
89
loop {
90
90
let task = self . main_task_queue . pop_front ( ) ;
91
+
92
+ // If there's no main tasks and background tasksm
91
93
if task. is_none ( ) && self . background_task_count == 0 {
92
94
return Ok ( ( ) ) ;
93
95
}
94
96
97
+ // Background tasks are launched as soon as they are returned, so we don't put them into the queue.
95
98
if let Some ( task) = task {
96
99
debug_assert ! ( matches!( task. get_task_type( ) , TaskType :: Main ) ) ;
97
100
self . handle_task_result ( task. main_run ( ctx) . await ) ?;
You can’t perform that action at this time.
0 commit comments