The latest CI artifact is set to the result of the card list Scryfall API call. This means that if the card list from run 1 is [a, b], then cards a and b will get sent out. If the list from run N is [a, b, c], then card c will get sent out. Then if the card list from run N + 1 is somehow [a, b], then the latest artifact going into run N + 2 is [a, b]. This will lead to an eventual run N + M in which item c comes back and card c gets sent out again. It is not good to have a card get sent out twice.
Solution
Instead of saving the artifact as the list of the result of the all cards list, it should be the old cards list merged in with the new cards. Using the example above, if the result from run N is [a, b, c] and run N + 1 detects [a, b], then run N + 1 should emit removeDuplicates([...[a, b, c], ...[a, b]]).
Current Behavior
The latest CI artifact is set to the result of the card list Scryfall API call. This means that if the card list from run 1 is
[a, b]
, then cardsa
andb
will get sent out. If the list from run N is[a, b, c]
, then cardc
will get sent out. Then if the card list from run N + 1 is somehow[a, b]
, then the latest artifact going into run N + 2 is[a, b]
. This will lead to an eventual run N + M in which itemc
comes back and cardc
gets sent out again. It is not good to have a card get sent out twice.Solution
Instead of saving the artifact as the list of the result of the all cards list, it should be the old cards list merged in with the new cards. Using the example above, if the result from run N is
[a, b, c]
and run N + 1 detects[a, b]
, then run N + 1 should emitremoveDuplicates([...[a, b, c], ...[a, b]])
.