mirror of
https://github.com/narrrl/holy-flavor-rater.git
synced 2026-11-03 16:41:27 +01:00
updated worker logic
This commit is contained in:
1 parent
eb2141c5af
commit
553c2a1707
2 files changed
+18
-17
No files matched your search
@@ -23,7 +23,7 @@ class Command(BaseCommand):
|
||||
# or those where next_run has passed.
|
||||
now = timezone.now()
|
||||
jobs_to_run = Job.objects.filter(
|
||||
status__in=['pending', 'failed']
|
||||
~models.Q(status='running')
|
||||
).filter(
|
||||
# Run if pending OR (next_run is set AND has passed)
|
||||
models.Q(status='pending') |
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
Table, TableBody, TableCell, TableContainer, TableHead, TableRow,
|
||||
Paper, Stack, alpha, CircularProgress, Chip, TextField, IconButton,
|
||||
useMediaQuery, Tabs, Tab, List, ListItem, ListItemText, Switch, Divider,
|
||||
Alert
|
||||
Alert, Select, MenuItem, FormControl
|
||||
} from '@mui/material';
|
||||
import EditIcon from '@mui/icons-material/Edit';
|
||||
import EmailIcon from '@mui/icons-material/Email';
|
||||
@@ -509,23 +509,24 @@ const AdminDashboard: React.FC = () => {
|
||||
</Grid>
|
||||
<Grid size={{ xs: 12, md: 4 }}>
|
||||
<Typography variant="caption" color="text.secondary" display="block">Next Run</Typography>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
||||
<Typography variant="body2">{job.next_run ? formatDate(job.next_run) : (job.interval_hours > 0 ? 'Queued...' : 'Disabled')}</Typography>
|
||||
<Button size="small" onClick={() => {
|
||||
const val = prompt('Set next run (YYYY-MM-DD HH:MM):', job.next_run ? job.next_run.substring(0, 16).replace('T', ' ') : '');
|
||||
if (val !== null) handleUpdateJobSchedule(job.id, job.interval_hours, val);
|
||||
}}>Edit</Button>
|
||||
</Box>
|
||||
<Typography variant="body2">{job.next_run ? formatDate(job.next_run) : (job.interval_hours > 0 ? 'Queued...' : 'Disabled')}</Typography>
|
||||
</Grid>
|
||||
<Grid size={{ xs: 12, md: 4 }}>
|
||||
<Typography variant="caption" color="text.secondary" display="block">Interval (Hours)</Typography>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
||||
<Typography variant="body2" sx={{ fontWeight: 'bold' }}>{job.interval_hours}h</Typography>
|
||||
<Button size="small" onClick={() => {
|
||||
const val = prompt('Set interval in hours (0 to disable):', String(job.interval_hours));
|
||||
if (val !== null) handleUpdateJobSchedule(job.id, parseInt(val));
|
||||
}}>Change</Button>
|
||||
</Box>
|
||||
<Typography variant="caption" color="text.secondary" display="block" sx={{ mb: 0.5 }}>Schedule</Typography>
|
||||
<FormControl size="small" fullWidth>
|
||||
<Select
|
||||
value={job.interval_hours}
|
||||
onChange={(e) => handleUpdateJobSchedule(job.id, Number(e.target.value))}
|
||||
sx={{ height: 32, fontSize: '0.875rem' }}
|
||||
>
|
||||
<MenuItem value={0}>Disabled</MenuItem>
|
||||
<MenuItem value={1}>Hourly</MenuItem>
|
||||
<MenuItem value={6}>Every 6 Hours</MenuItem>
|
||||
<MenuItem value={12}>Every 12 Hours</MenuItem>
|
||||
<MenuItem value={24}>Daily</MenuItem>
|
||||
<MenuItem value={168}>Weekly</MenuItem>
|
||||
</Select>
|
||||
</FormControl>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
|
||||
Reference in new issue
Block a user