|
- <%
- ' Test fixture (tests/phase3-jobs.sh only): puts an ingestion job into states that the API cannot produce on demand,
- ' to simulate interruptions and failures. Never use against data you care about.
- ' FIX_ACTION=stale FIX_ID=<job> claimed long ago and never finished (process died mid-ingest)
- ' FIX_ACTION=failed FIX_ID=<job> FIX_N=<attempts> failed with a retryable internal_error after n attempts
- ' FIX_ACTION=corrupt FIX_ID=<job> queued with an unreadable stored input
- ' FIX_ACTION=nopayload FIX_ID=<job> failed and its stored input gone
- ' FIX_ACTION=nowrite FIX_ID=<principal> removes the principal's grants (permission lost before processing)
- ' FIX_ACTION=chunks FIX_ID=<document> prints the number of chunk rows of the document (all revisions)
- %>
- <!--#include file="../../core/autoload_core.asp" -->
- <%
- Dim sh, act, id, n, rs
- Set sh = CreateObject("WScript.Shell")
- act = sh.ExpandEnvironmentStrings("%FIX_ACTION%")
- id = sh.ExpandEnvironmentStrings("%FIX_ID%")
- n = sh.ExpandEnvironmentStrings("%FIX_N%")
- Select Case act
- Case "stale"
- DAL().Execute "UPDATE jobs SET state = 'running', attempt_count = 1, updated_at = '2000-01-01 00:00:00' WHERE id = ?", id
- Case "failed"
- DAL().Execute "UPDATE jobs SET state = 'failed', error_code = 'internal_error', attempt_count = " & CLng(n) & ", updated_at = '2000-01-01 00:00:00' WHERE id = ?", id
- Case "corrupt"
- DAL().Execute "UPDATE jobs SET state = 'queued', payload = '{bad' WHERE id = ?", id
- Case "nopayload"
- DAL().Execute "UPDATE jobs SET state = 'failed', error_code = 'internal_error', payload = NULL WHERE id = ?", id
- Case "nowrite"
- DAL().Execute "DELETE FROM access_grants WHERE principal_id = ?", id
- Case "chunks"
- Set rs = DAL().Query("SELECT COUNT(*) FROM chunks WHERE document_id = ?", id)
- Response.Write rs(0) & vbCrLf
- rs.Close
- End Select
- Response.Write "ok" & vbCrLf
- %>
|