Skip to content

Rebuild how failed logs are removed to be a cron #42

@mgwidmann

Description

@mgwidmann

PRs are crashing due to a foreign key constraint error (which is good because that means it cannot delete something it should not).

Task #PID<0.2979.0> started from :"pr-somerepo-12345" terminating
** (Ecto.ConstraintError) constraint error when attempting to insert struct:

    * foreign_key: random_failures_failure_log_id_fkey

If you would like to convert this constraint into an error, please
call foreign_key_constraint/3 in your changeset and define the proper
constraint name. The changeset has not defined any constraint.

    (ecto) lib/ecto/repo/schema.ex:570: anonymous fn/4 in Ecto.Repo.Schema.constraints_to_errors/3
    (elixir) lib/enum.ex:1255: Enum."-map/2-lists^map/1-0-"/2
    (ecto) lib/ecto/repo/schema.ex:555: Ecto.Repo.Schema.constraints_to_errors/3
    (ecto) lib/ecto/repo/schema.ex:219: anonymous fn/14 in Ecto.Repo.Schema.do_insert/4
    (ecto) lib/ecto/repo/schema.ex:768: anonymous fn/3 in Ecto.Repo.Schema.wrap_in_transaction/6
    (ecto) lib/ecto/adapters/sql.ex:576: anonymous fn/3 in Ecto.Adapters.SQL.do_transaction/3
    (db_connection) lib/db_connection.ex:1275: DBConnection.transaction_run/4
    (db_connection) lib/db_connection.ex:1199: DBConnection.run_begin/3
Function: &SlackCoder.Services.RandomFailureService.save_random_failure/1

Rebuild it to periodically clean up randomly failed jobs that are not necessary to be kept around any longer instead of cleaning up the jobs as they are completed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions