lundi 22 novembre 2021

Best way to call multiple operations multiple times after another

I have the following scenario:

there are 3 API's that I call every 5 minutes. I do this asynchronously so the order of calling the API doesn't matter. A 'call' itself contains

  1. A HTTP-request to the API
  2. The extraction of data (reading the response)
  3. Storing it into a Database.

so these 3 steps are always the same. Currently my code looks somewhat like this:

scraper.Request()
scraper.Extract()
scraper.Save()

I surely put that into another function to wrap it up but it somehow looks weird to me. Are there any 'Patterns' I could follow, that match my scenario?

Thanks in Advance

Aucun commentaire:

Enregistrer un commentaire