Fix schedule maxrunning logic
Merge pull request #12354 from olliewalsh/fix_12340

Fix schedule maxrunning logic