Slow to connect bluetooth mouse and keyboard
When waking my iMac from sleep, the bluetooth Mighty Mouse and keyboard are very slow to connect. Sometimes they are so slow that the iMac goes back to sleep before connection is established. Occasionally when it goes back to sleep, nothing I can do will wake it up again, and my only recourse is a forced shutdown followed up by a restart. This obviously is not good.
Why are my bluetooth devices taking so long to connect, and is there anything I can do to prevent the 'going back to sleep' situation?
Thanks.
iMac, macOS High Sierra (10.13.5), i7 2.8Ghz, 12 GB RAM