Skip to content

Dotnet Background Processing

Akshay B edited this page Mar 16, 2026 · 2 revisions

Dotnet Background Processing (Azure Functions)

This document details asynchronous background processing in PluckIt.Functions.

Documentation metadata

  • Audience: external contributors
  • Last reviewed: 2026-03-16
  • Scope: queue and timer contracts only

Queue worker: ProcessImageJob

  • Trigger: ProcessImageJob queue function
  • Queue name: image-processing-jobs
  • Input message: ImageProcessingMessage
  • Workflow:
    1. Idempotency check (DraftStatus == Processing)
    2. Download raw blob
    3. Optional segmentation path:
      • If skip_segmentation is true, upload archive directly
      • Else call Python processor endpoint /api/process-image
    4. Parse processor result and persist draft terminal state
    5. Extract clothing metadata from processed image
    6. Write DraftStatus.Ready or Failed with error text

Timer worker: CleanupAbandonedDrafts

  • Trigger: 0 0 3 * * * (03:00 UTC)
  • Behavior:
    • Mark stale Processing drafts older than 2 hours as Failed
    • Purge old Failed drafts older than 7 days
    • Also performs related blob cleanup

Operational notes: queue and timer failure behavior

  • Failure mode: ProcessImageJob error before final draft write
    • Expected outcome: draft transitions to DraftStatus.Failed with ErrorText populated, or remains retriable on re-invocation
    • Retry/alert: call POST /api/wardrobe/drafts/{id}/retry; track retry counts and alarm on sustained Failed spikes
  • Failure mode: queue message consumed while host restarts mid-processing
    • Expected outcome: message can be retried; idempotency guard prevents duplicate finalization when DraftStatus != Processing
    • Retry/alert: check queue depth and dead-letter activity
  • Failure mode: CleanupAbandonedDrafts miss at schedule window
    • Expected outcome: stale Processing and stale Failed records remain until next successful timer run
    • Retry/alert: alert on cron drift and LastSuccess lag > 25h
  • Failure mode: timer blocked by partial failures (blob/API cleanup errors)
    • Expected outcome: cleanup of terminal states may be incomplete while visible to queries
    • Retry/alert: rerun timer manually after dependency recovery and track failed blob deletion counts

Issue update log

  • 2026-03-16: Implemented issue #59 in ClothingMetadataService so invalid LLM category values from metadata extraction are now validated against an allowlist, with fallback to Uncategorised and warning logging.

Clone this wiki locally