Skip to content

Commit

Permalink
Debug purge
Browse files Browse the repository at this point in the history
  • Loading branch information
mbryzek committed Jun 10, 2024
1 parent 67b5222 commit aba1252
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions api/app/processor/PurgeDeletedProcessor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,33 @@ class PurgeDeletedProcessor @Inject()(
usersDao: UsersDao,
) extends TaskProcessor(args, TaskType.PurgeDeleted) {

private[this] def debug(msg: String): Unit = {
println(s"[${DateTime.now} DEBUG] $msg")
}

override def processRecord(id: String): ValidatedNec[String, Unit] = {
debug("PurgeDeletedProcessor starting to delete versions")
deleteAll(Tables.versions) { row =>
debug(s" - version: ${row.pkey}")
softDelete(Table.guid("cache.services"))(_.equals("version_guid", row.pkey))
softDelete(Table.long("public.originals"))(_.equals("version_guid", row.pkey))
softDelete(Table.guid("public.changes"))(_.equals("from_version_guid", row.pkey))
softDelete(Table.guid("public.changes"))(_.equals("to_version_guid", row.pkey))
}

debug("PurgeDeletedProcessor starting to delete applications")
deleteAll(Tables.applications) { row =>
debug(s" - application: ${row.pkey}")
softDelete(Table.guid("public.application_moves"))(_.equals("application_guid", row.pkey))
softDelete(Table.guid("public.changes"))(_.equals("application_guid", row.pkey))
hardDelete(Table.guid("search.items"))(_.equals("application_guid", row.pkey))
softDelete(Table.guid("public.watches"))(_.equals("application_guid", row.pkey))
softDelete(Table.guid("public.versions"))(_.equals("application_guid", row.pkey))
}

debug("PurgeDeletedProcessor starting to delete applications")
deleteAll(Tables.organizations) { row =>
debug(s" - organization: ${row.pkey}")
softDelete(Table.guid("public.application_moves"))(_.equals("from_organization_guid", row.pkey))
softDelete(Table.guid("public.application_moves"))(_.equals("to_organization_guid", row.pkey))
hardDelete(Table.guid("search.items"))(_.equals("organization_guid", row.pkey))
Expand All @@ -49,6 +59,7 @@ class PurgeDeletedProcessor @Inject()(
softDelete(Table.guid("public.applications"))(_.equals("organization_guid", row.pkey))
}

debug("done")
().validNec
}

Expand Down

0 comments on commit aba1252

Please sign in to comment.