Risk of miscarriage from stress?

Hey everyone,
So today my vet confirmed that my elderly beagle has prostate cancer and will eventually need to be put to sleep.  I am obviously very upset but I also knew this was coming (We had a good idea cancer was the issue 12 days ago at first apt).  I feel able to keep my sadness and stress under control right now but am very concerned about when it comes time to put him to sleep.  I have no idea how long he has left with me.
Back in July I was pregnant- just over 5 weeks, when I took my moms dog to be put to sleep due to sinus cancer.  I miscarried the next day.  I have no idea if that was a coincidence or if the stress and extreme sadness of the experience contributed to my miscarriage.
I know it is inevitable that I will have to put my fur baby to sleep in the near future...but I don't want to lose my himan baby in the process.
What can I do? Any thoughts?