File size: 606 Bytes
cdc50ff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { normalizeTitle } from '../utils/normalize.js';

// In-memory map for processing status
// In production, this would be Redis or similar
const processingState = new Map();

// States: 'processing' | 'ready' | 'error'
export function setProcessing( title, state, error = null ) {
	processingState.set( normalizeTitle( title ), { state, error, timestamp: Date.now() } );
}

export function getProcessingState( title ) {
	return processingState.get( normalizeTitle( title ) ) || { state: 'unknown' };
}

export function clearProcessing( title ) {
	processingState.delete( normalizeTitle( title ) );
}