mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* Perform db migration on workflow instances to add fields related to error healthcheck * Create connector health check workflow * Only pause a schedule if there is a reason * Only return errors for schedules which returned errors at least 5 times * Create healtcheck schedule when connectors are installed * Add new schedule fields to openapi spec * Make connector health check interval configurable * Fix concurrent indexes on schedules table * Unpause schedules automatically if connector config is updated * Ensure we only update the schedule interval for schedules related to connector capabilities * Ensure we never pause schedules that have fewer than 5 faulty executions * Add ConnectorHealthCheck to e2e expected schedules * Only pause schedules if the latest error ocurred after the connector config was last updated * Add connector updated at to api spec * Allow healthcheck threshold to be configurable * Reduce logs in temporal workflow tests * Use utc in update schedule polling period tests * Add unit tests for storage pause and unpause * Add unit tests for connector health check workflow and underlying activity * populate connectors.updated_at value for existing connectors * Use both connectorID and schedule id in pause and unpause functions to make the most of the primary key * Fix alignment of workflow instances file * Split migration into multiple files * Only consider terminated instances * Rename healthcheck check function for clarity and add additional index * Rename flag to connector-health-check-interval * Reorganize migration files * Run just generate * ensure that when the instance.CreatedAt is equal to connector.UpdatedAt it also gets excluded * Perform stricter schedule ID checking * Remove IF NOT EXISTS keyword from migrations
25 lines
632 B
PL/PgSQL
25 lines
632 B
PL/PgSQL
ALTER TABLE schedules
|
|
ADD COLUMN paused_at timestamp without time zone,
|
|
ADD COLUMN paused_reason text;
|
|
|
|
ALTER TABLE connectors
|
|
ADD COLUMN updated_at timestamp without time zone;
|
|
|
|
UPDATE connectors SET updated_at = created_at WHERE updated_at IS NULL;
|
|
|
|
CREATE OR REPLACE FUNCTION set_connectors_updated_at()
|
|
RETURNS TRIGGER AS $$
|
|
BEGIN
|
|
NEW.updated_at = NOW();
|
|
RETURN NEW;
|
|
END;
|
|
$$ LANGUAGE plpgsql;
|
|
|
|
DROP TRIGGER IF EXISTS connectors_updated_at_trigger ON connectors;
|
|
|
|
CREATE TRIGGER connectors_updated_at_trigger
|
|
BEFORE UPDATE ON connectors
|
|
FOR EACH ROW
|
|
EXECUTE FUNCTION set_connectors_updated_at();
|
|
|