Reinstalling an application creates a ghost of its schedules
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- redis, typescript
- Área
- backend
Línea de trabajo
Start with the scheduler configuration in devvit.json, the route shown in index.ts, and the scheduler.listJobs() result. Reproduce the install, uninstall, and reinstall sequence, then trace which scheduled jobs remain and how the Redis-stored widget ID is used. Done means uninstalling removes prior schedules so reinstalling leaves only the current job and does not create duplicate widget updates.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Reddit does not properly clean up apps when they are uninstalled.
You can reproduce this by adding a schedule in your devvit.json. like so:
"scheduler": {
"tasks": {
"daily-guides": {
"endpoint": "/internal/scheduler/daily-guides",
"cron": "* * * * *"
}
}
},
Then, configure a route to handle it:
// index.ts.
router.post("/internal/scheduler/daily-guides", scheduleFunction);
// Maybe in another file...
import { context, reddit, redis } from "@devvit/web/server";
export async function scheduleFunction() {
const widgetId = await redis.get('schedule-key');
if (!widgetId) {
console.info("Widget not found. Creating one.");
const widget = await reddit.addWidget({
subreddit: context.subredditName,
type: "textarea",
shortName: "Countdown",
text: "test",
});
await redis.set('schedule-key', widget.id);
return;
}
await reddit.updateWidget({
subreddit: context.subredditName,
type: "textarea",
id: widgetId,
shortName: "Countdown",
text: "test",
});
}
Then:
- Install the app to a subreddit
- Uninstall it after several minutes
- Install the app to the aforementioned subreddit
After a few minutes after step 3, you'll have a mod log like this:
It looks like the first scheduled has returned and it is updating the widget from the id stored in Redis somehow. It shouldn't know that it is still there. Then, it starts a new schedule from installation, creating a widget since it doesn't know anything about the subreddit which is expected behaviour, stores the widget id in Redis, and proceeds to edit it. This leads to 2 widgets.
If you run await scheduler.listJobs();, only 1 job would be listed–the job you started your application with to log that in the first place–not 2. The other schedule is now a ghost–you cannot find it, you cannot stop it, you cannot uninstall your application as a workaround as demonstrated above... it's totally broken.
I'd appreciate if a lurking administrator can resolve my prior schedules (my application is in the above screenshot)!
- Lenguaje dominante
- TypeScript
- Estrellas
- 210
- Forks
- 88
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de reddit/devvit
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 42/100
Todos los issues de reddit/devvit
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
copse-dev/agent-pane#2953 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
[Bug]: Matrix progress drafts fail with "Matrix runtime not initialized" during tool activity Abiertobug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Client support matrix inclusion Abiertoenhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
calcite-components needs triage refactor
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Esri/calcite-design-system#15203 ·