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

internal/controller: add exponential backoff #264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

datdao
Copy link
Member

@datdao datdao commented Feb 13, 2025

This PR replaces the retry mechanism for errors from a fixed 5-second interval to an exponential backoff strategy. The delay is now calculated base on the number of failures for each resource.

A backoffLimit field has been added to the spec to configure the maximum number of retries. By default, it is set to 20. If backoffLimit is set to 0, retries will be unlimited.

When the number of retries exceeds the backoffLimit, the controller will log an event to notify about this.
Screenshot 2025-02-13 at 20 53 45

Example of setting backoffLimit for AtlasMigration and Atlas Schema resources:

apiVersion: db.atlasgo.io/v1alpha1
kind: AtlasMigration
metadata:
  name: mysql
spec:
  backoffLimit: 5
  dir:
    configMapRef:
      name: "migration-dir"
---
apiVersion: db.atlasgo.io/v1alpha1
kind: AtlasSchema
metadata:
  name: mysql
spec:
  backoffLimit: 5
  schema:
    sql: |
      create table users (
        id int not null auto_increment,
        name varchar(255) not null,
        email varchar(255) unique not null,
        short_bio varchar(255) not null,
        primary key (id)
      );

@datdao datdao force-pushed the d/backoff branch 3 times, most recently from f98dd78 to 6c67a63 Compare February 13, 2025 09:58
@datdao datdao requested review from giautm and rotemtam February 14, 2025 08:23
@datdao datdao marked this pull request as ready for review February 14, 2025 08:23
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.

1 participant