Table of Contents

Enum EmailQueueState

Namespace
FishMMO.Database.Data
Assembly
FishMMO-DB.dll

Where an email queue row is in its life.

public enum EmailQueueState

Fields

Claimed = 1

Claimed by a login server, which has not yet said whether it went out.

Failed = 2

Claimed, and the last delivery attempt recorded an error.

Pending = 0

Queued and unclaimed. Waiting for a login server to pick it up.

Sent = 3

Delivered.

Remarks

There is no state column. email_queue models delivery with three nullable columns — sent_at, claimed_at and last_error — and the state is the combination of them. This enum is that combination named, decided in one place so the filter, the counts and the badge in the browser cannot disagree about what "failed" means.

The order of the tests matters and is part of the definition:

  1. sent_at set — Sent. Delivered; nothing else about the row matters.
  2. claimed_at null — Pending. In line, waiting for a login server to take it. This is the state the queue drains from, and the state that piles up when no login server is running.
  3. last_error set — Failed. A login server took it and the delivery attempt errored.
  4. otherwise — Claimed. A login server holds it and has not reported an outcome.

Pending is tested before the error so that a retried row reads as pending again: retrying releases the claim but deliberately keeps last_error, because the text of the failure is the only evidence of why it failed and an operator retrying a second time needs it. Were the order reversed, a row put back in line would still read as failed.