QutEcoacoustics / baw-server

The acoustic workbench server for storing and managing ecoacoustic data. Manages the structure and audio data. Provides an API for clients access.
Apache License 2.0
9 stars 4 forks source link

If a harvest fails to save because of a validation, side effects still happen #672

Open atruskie opened 7 months ago

atruskie commented 7 months ago

With an invalid mapping:

  1. you hit finish
  2. state machine started changing
  3. sftp connection was deleted
  4. password and user removed from model
  5. model attempted tbe saved with status: scanning and password: null and username: null
  6. model save failed because of the validation
  7. connection is still deleted but the other changes were rolled back

Now the harvest can't continue, and the sftp connection is not available even though the model suggests it should be.

Possible solutions:

Kinda: https://github.com/QutEcoacoustics/baw-server/blob/40eb8002c1d10632b132b86b6fa94547ed637945/app/controllers/harvests_controller.rb#L36C14-L36C49 but it shortcuts it because we're less than two weeks