ciandt / tech-gallery

A living Technology Gallery built on top of Google App Engine's platform.
Apache License 2.0
39 stars 31 forks source link

Move tasks arguments to a Kind #241

Open jeanpimentel opened 4 years ago

jeanpimentel commented 4 years ago

Fix exception IllegalArgumentException: Task size too large.

These exceptions appears at cron jobs when the payload is too large, and it occurs a lot since one of the arguments is a html email body.

The maximum task size is 100KB for push queues https://cloud.google.com/appengine/quotas#Task_Queue

We already had the EmailNotification Kind, and it is used to track when a email was sent (with success/failure status).

Changes in it:

Other changes were made in two points: push and execute

  1. When pushing to queue, we copy the EmailConfig information into an EmailNotification entity and save it. Then, we pass just the ID as a parameter instead of all data.
  2. Then, when executing the task, we just retrieve the information from Datastore and proceed.