mailR and Amazon Simple Email Service (Amazon SES)
Closed this issue · 1 comments
mailR is a simple and effective way to send email from R using Amazon SES. I have written a Shiny web app that sends email to users this way.
I don't think it has anything specifically to do with mailR, but one issue I'm struggling with is that when an email is sent from my Shiny app, the sender's screen goes dim and Shiny appears to have crashed for about 10 seconds, then it comes back to life. I assume this is because the single R thread is busy interacting with Amazon SES and Shiny thinks it might be gone forever.
This happens both on my 4 core development computer and my 1 core Amazon EC2 server.
Given that you have a lot more experience with the relevant protocols and apis than I do, do you have any suggestions on how to avoid this screeching halt in the action?
Hi, @TomWeishaar . It has little to do with shiny or mailR. R is a single thread language and the function that takes time to run will block shiny.
The solution could be one of the following:
-
use callr to launch a background thread to send the email, something like
callr::r_bg(function() Sys.sleep(10))
(recommend) -
or, you can try the dev version of shiny, which is going to officially support promise. I think it needs you to understand the future package