taubyte / tau

Open source distributed Platform as a Service (PaaS). A self-hosted Vercel / Netlify / Cloudflare alternative.
https://tau.how
BSD 3-Clause "New" or "Revised" License
3.36k stars 93 forks source link

refactor: retry logic for deployment key #223

Closed mohitsethia closed 3 months ago

mohitsethia commented 3 months ago

Closes #152

Sometimes, a build might be triggered before the repository is registered, which mean a deployment key was added. For these reason we have a retry logic here https://github.com/taubyte/tau/services/monkey/job.go#L88. Frankly, this code does not look good.

I suggest moving the check for deployment key to https://github.com/taubyte/tau/services/monkey/job.go#L41, and use a helper function that will retry for a number of times till we get repo with a deployment key.

Add a reusable Retry helper function.