Amidst the time-consuming process of conducting laboratory tests to confirm contamination incidents, utilities must promptly implement measures to mitigate the impact of potential contamination without undue overreaction. This paper proposes a novel approach for mitigating the impact of contamination threats (an unconfirmed contamination event) in smart water networks. By leveraging smart valves, the consumer flows are regulated to create a decreasing pressure gradient from the contamination source to a flushing point, facilitating efficient contamination flushing with minimal consumer inconvenience. The decreasing pressure gradients are formulated as constraints within an online optimization problem. Additionally, two methods for identifying these pressure constraints are presented. To assess the efficacy of the proposed framework, testing is conducted using a realistic water network model.