In certain circumstances, with certain combinations of modules, hook_node_update() via node_save() can be called twice, causing simplenews_add_node_to_spool() to run twice. See for example #1995780: When using with Views bulk operations (VBO), node_save is called twice.

Simplenews is probably right to assume that node_save() is called only once when a node is saved. However, there is no harm done by making sure of it before insert a second identical entry into the spool.

Comments

alberto56’s picture

Status: Active » Needs review
StatusFileSize
new1.42 KB

Here is a patch that checks if a row with the same nid, tid, snid and mail already exists in the spool before adding it again.

We might also want to check if was added in the last few seconds if we want to make really sure it is the same entry, which I did not do, because I prefer my subscribers to never receive the same node twice (even if updated).

Cheers,

Albert.

luksak’s picture

Issue summary: View changes

I have a site where newsletters are being sent twice from time to time. Is this caused by this issue?