abhishek-ram / django-pyas2

AS2 file transfer Server built on Python and Django.
https://django-pyas2.readthedocs.io
GNU General Public License v3.0
78 stars 31 forks source link

Changes to duplicate handling #37

Open chadgates opened 4 years ago

chadgates commented 4 years ago

Function to identify for earlier duplicate changed to check for status "S" or "P". Adding new setting ERROR_ON_DUPLICATE with default value True to preserve how application behaves now. If False, duplicate messages will be handled like success messages, but message_id to still have _duplicate added to it.

Currently, if no error is created for duplicate, the content of the message is stored once more. So if this should not happen, then various options should be checked: pyas2lib would have to be adjusted to "continue on duplicate" and let django-pyas2 decide what it wants to do with a duplicate message - maybe by adding another status "D" that could then be used to decide if file should be stored or not. Or have pyas2lib receive options what to do on duplicate.

codecov[bot] commented 4 years ago

Codecov Report

Merging #37 into master will increase coverage by 0.03%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #37      +/-   ##
==========================================
+ Coverage   97.56%   97.60%   +0.03%     
==========================================
  Files          11       11              
  Lines         576      584       +8     
==========================================
+ Hits          562      570       +8     
  Misses         14       14              
Impacted Files Coverage Δ
pyas2/settings.py 100.00% <100.00%> (ø)
pyas2/views.py 97.94% <100.00%> (+0.10%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9b8fac3...7438a52. Read the comment docs.

abhishek-ram commented 4 years ago

I think we need to remove the unique together for message_id and partner. If not when there is a failed message and then its retries it would cause integrity error i think, can you also add this to the test case.

chadgates commented 4 years ago

That can be removed, but should we then also remove the "_duplicate" from the message id on receiving duplicates? This currently prevents the integrity error for the first retry.

chadgates commented 3 years ago

Any changes requested for this PR? Options are :

abhishek-ram commented 3 years ago

So I guess I was wrong and it wont fail because I am doing an update or create in create_from_as2message method. But in essence it would update the existing message (case where flag is set to True and original message failed say due to invalid signature) i guess which is okay?