ONSdigital / sdx-seft-consumer-service

Microservice for consuming SEFT files from RAS and sending to ONS internal
MIT License
1 stars 1 forks source link

Should check AV before receipting #57

Closed necrophonic closed 5 years ago

necrophonic commented 5 years ago

Currently sends receipt before checking the file through the AV service. This means that if the AV service is unavailable the receipt gets sent and the file re-queued, causing multiple receipts to be sent whilst waiting for the service to become available.

In app/main.py ~ line 109:

...
  payload = self.extract_file(decrypted_payload, tx_id)
  self.bound_logger = self.bound_logger.bind(case_id=payload.case_id, survey_id=payload.survey_id)
  self._send_receipt(payload.case_id, tx_id)

  if settings.ANTI_VIRUS_ENABLED:
      av_check = AntiVirusCheck(tx_id=tx_id)
      av_check.send_for_av_scan(payload)
...
pricem14pc commented 5 years ago

In principle, sending the receipt before checking the file is fine. The receipting is confirmation that we have received the file from the respondent so this should happen as close to the upload as possible. Having it as part of the flow that does the scan result (re)requests is the issue.

insacuri commented 5 years ago

Closing because this service doesn't receipt anymore