State_overrides within worker_overrides

Can I do something like:

plugins: [{
  Oban.Pro.Plugins.DynamicPruner,
  worker_overrides: [
    "MyApp.BusyWorker": {:max_age, {1, :day}},
    "MyApp.SecretWorker": {:max_age, {1, :second}},
    "MyApp.HistoricWorker": {:max_age, {1, :month},
state_overrides: [
    cancelled: {:max_len, :infinity},
    discarded: {:max_age, :infinity}
  ]}
  ]
}]

so when successful, it gets pruned in a month, if not successful it never gets pruned?

Not exactly. The order goes queue, state, worker, where later rules trump earlier rules. Since the state overrides are longer (:infinity), the worker overrides supersede the state. The plugin needs a way to arbitrarily compose rules to accomplish what you’re asking and we’re not there yet.

You’re not alone in requesting that specific type of override though!