Both options are technically grammatically correct, but the one that makes the most sense in this sentence is "when."
1.6m questions
2.0m answers