Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-11306: Catch exception if elasticsearch query fails #17

Merged
merged 6 commits into from
Jan 21, 2025

Conversation

hyrsky
Copy link
Contributor

@hyrsky hyrsky commented Jan 17, 2025

UHF-11306

Improve hakuvahti error handling. Catch exception if elastic query fails.

Testing

  • Make sure rekry is running locally, https://elastic-helfi-rekry.docker.so/ is accessible, run drush sapi-rt && drush sapi-c && drush sapi-i.
  • Create dotenv file cp .env.dist .env, copy ATV api key from key vault to .env.
  • Start hakuvahti: make up
  • Create valid and invalid hakuvahti:
    • Create new hakuvahti with invalid query: curl -X POST 'http://localhost:3000/subscription' -H 'Token: dingdong' -H 'Content-Type: application/json' --data '{"elastic_query": "ZGluZ2Rvbmc=", "search_description": "test", "query": "example.com", "email": "test@example.com", "lang": "fi"}'
    • Create new hakuvahti with valid query from https://helfi-rekry.docker.so/fi/avoimet-tyopaikat/etsi-avoimia-tyopaikkoja.
  • Send emails: make shell, npm run hav:send-emails-in-queue.
  • Check https://mailpit.docker.so, confirm both subscriptions.
  • In rekry set field_publication_starts to some future date for any job listing, for example this. Run drush sapi-i.
  • Run make shell, npm run hav:populate-email-queue && npm run hav:send-emails-in-queue.
  •  Check https://mailpit.docker.so/, you should have new results even though there was subscription with invalid query.
  • Code follows our standards.

@hyrsky hyrsky force-pushed the UHF-11306-hakuvahti-fixes branch from ed3d6f9 to 87c9ae6 Compare January 20, 2025 12:53
Copy link
Contributor

@teroelonen teroelonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works really nicely 🦖

@hyrsky hyrsky merged commit 557e8fd into dev Jan 21, 2025
@hyrsky hyrsky deleted the UHF-11306-hakuvahti-fixes branch January 21, 2025 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants