Closed M-Welsch closed 2 years ago
issue still present:
2596879 30.06.2022 06:15:32 INFO: BaSe.base.hardware.power: Unpowering HDD
2596880 30.06.2022 06:15:32 DEBUG: BaSe.base.hardware.mechanics: Already undocked
2596881 30.06.2022 06:15:32 INFO: BaSe.base.hardware.hardware: Preparing SBU for shutdown. Wake up in 3867s. Transferring timestamp: 30.06.2022 07:20
2596882 30.06.2022 06:15:33 INFO: BaSe.base.hardware.sbu.sbu: Command: message_code = BU, payload = 3867
2596883 30.06.2022 06:15:34 INFO: BaSe.base.base_application: Exiting BaSe Application, about to shut down
2596884 30.06.2022 06:15:34 DEBUG: BaSe.base.common.config.bound: reloading config: /home/base/base-bcu/base/config/notification.json
inexplicable. Docu (https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.sendmail) says, the send_message
function returns normally when at least one recipient has not refused to accept the message. I understand this as statement that the function call is blocking.
This method will return normally if the mail is accepted for at least one recipient. Otherwise it will raise an exception. That is, if this method does not raise an exception, then someone should get your mail. If this method does not raise an exception, it returns a dictionary, with one entry for each recipient that was refused. Each entry contains a tuple of the SMTP error code and the accompanying error message sent by the server.
wrote test program
from base.common.mailer import Mailer
from os import urandom
from time import time
if __name__ == "__main__":
bulkfile = "bulkfile.dings"
bulkfile_size = 5e7
with open(bulkfile, "wb") as fout:
fout.write(urandom(int(bulkfile_size)))
tick = time()
Mailer().send_summary_bulk("bla")
print(f"Mail without bulk took {time()-tick}s to complete")
tick = time()
Mailer().send_summary_bulk(bulkfile)
print(f"Mail with {(bulkfile_size/1e6):.2f}MB bulk took {time()-tick}s to complete")
output
WARNING: Logger has been initialized with default values. Not for production.
27.09.2022 20:58:48 DEBUG: BaSe.base.common.config.bound: reloading config: base/config/notification.json
27.09.2022 20:58:57 INFO: BaSe.base.common.mailer: Email sent
Mail without bulk took 8.727355241775513s to complete
27.09.2022 20:58:57 DEBUG: BaSe.base.common.config.bound: reloading config: base/config/notification.json
27.09.2022 20:59:00 INFO: BaSe.base.common.mailer: Email sent
Mail with 50.00MB bulk took 3.1230289936065674s to complete
conclusion: eventhough the bulkfile is not really sent it shows that the completion of the mailer takes a significant amount of time. Therefore we close this issue with no need for any code change. @MaximilianStaab please notice.
Shutdown is issued before Mailer is finished.