Re-submit #19112

Although the PR says it was merged, it wasn't and the reactor is currently broken because of the partial merge of the previous refactor
just fyi, this change is not  python3 compat, python3 does not have the .next() method, you have to use the bif