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.
|
# or those where next_run has passed.
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
jobs_to_run = Job.objects.filter(
|
jobs_to_run = Job.objects.filter(
|
||||||
status__in=['pending', 'failed']
|
~models.Q(status='running')
|
||||||
).filter(
|
).filter(
|
||||||
# Run if pending OR (next_run is set AND has passed)
|
# Run if pending OR (next_run is set AND has passed)
|
||||||
models.Q(status='pending') |
|
models.Q(status='pending') |
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
Table, TableBody, TableCell, TableContainer, TableHead, TableRow,
|
Table, TableBody, TableCell, TableContainer, TableHead, TableRow,
|
||||||
Paper, Stack, alpha, CircularProgress, Chip, TextField, IconButton,
|
Paper, Stack, alpha, CircularProgress, Chip, TextField, IconButton,
|
||||||
useMediaQuery, Tabs, Tab, List, ListItem, ListItemText, Switch, Divider,
|
useMediaQuery, Tabs, Tab, List, ListItem, ListItemText, Switch, Divider,
|
||||||
Alert
|
Alert, Select, MenuItem, FormControl
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import EditIcon from '@mui/icons-material/Edit';
|
import EditIcon from '@mui/icons-material/Edit';
|
||||||
import EmailIcon from '@mui/icons-material/Email';
|
import EmailIcon from '@mui/icons-material/Email';
|
||||||
@@ -509,23 +509,24 @@ const AdminDashboard: React.FC = () => {
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Grid size={{ xs: 12, md: 4 }}>
|
<Grid size={{ xs: 12, md: 4 }}>
|
||||||
<Typography variant="caption" color="text.secondary" display="block">Next Run</Typography>
|
<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>
|
||||||
<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>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid size={{ xs: 12, md: 4 }}>
|
<Grid size={{ xs: 12, md: 4 }}>
|
||||||
<Typography variant="caption" color="text.secondary" display="block">Interval (Hours)</Typography>
|
<Typography variant="caption" color="text.secondary" display="block" sx={{ mb: 0.5 }}>Schedule</Typography>
|
||||||
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
<FormControl size="small" fullWidth>
|
||||||
<Typography variant="body2" sx={{ fontWeight: 'bold' }}>{job.interval_hours}h</Typography>
|
<Select
|
||||||
<Button size="small" onClick={() => {
|
value={job.interval_hours}
|
||||||
const val = prompt('Set interval in hours (0 to disable):', String(job.interval_hours));
|
onChange={(e) => handleUpdateJobSchedule(job.id, Number(e.target.value))}
|
||||||
if (val !== null) handleUpdateJobSchedule(job.id, parseInt(val));
|
sx={{ height: 32, fontSize: '0.875rem' }}
|
||||||
}}>Change</Button>
|
>
|
||||||
</Box>
|
<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>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user