Abu Hurairah (May Allah be pleased with him) reported:
The Messenger of Allah ﷺ, "The supplication of every one of you will be granted if he does not get impatient and say (for example): 'I supplicated my Rubb but my prayer has not been granted'."
[Al-Bukhari and Muslim].
The narration of Muslim is: "The supplication of a slave continues to be granted as long as he does not supplicate for a sinful thing or for something that would cut off the ties of kinship and he does not grow impatient." It was said: "O Messenger of Allah! What does growing impatient mean?" He ﷺ said, "It is one's saying: 'I supplicated again and again but I do not think that my prayer will be answered.' Then he becomes frustrated (in such circumstances) and gives up supplication altogether."
وعنه أن رسول الله ﷺ قال:
"يستجاب لأحدكم ما لم يعجل: يقول: قد دعوت ربي، فلم يستجب لي" ((متفق عليه)). وفي رواية لمسلم لا يزال يستجاب للعبد ما لم يدعُ بإثم أو قطيعة رحم ما لم يستعجل. قيل يا رسول الله ما الاستعجال؟ قال يقول قد دعوت وقد دعوت فلم أرَ من يستجب لي فيستحسر عند ذلك ويدع الدعاء.