frappe / frappe/agent

Stop polling for pending jobs

Open
#180 3 comments 0 reactions 1 assignee Claimed by @Aradhya-Tripathi View on GitHub
Dominant language
Python
Stars
125
Forks
147
Avg merge
17h 20m
Merged PRs (30d)
17

Description

**Problem**
Once a job is triggered by press on the build/other servers (Archive, New Bench etc.), a job is created on the press worker that polls for job status every 5 seconds (via [hooks](https://github.com/frappe/press/blob/master/press/hooks.py#L245)).

This problem causes obvious load on the servers.

**Solution**
Using sockets in agent (out of the box with [flask-socketIo](https://flask-socketio.readthedocs.io/])).
We also need to use gunicorn with eventlet. To allow for async connections

Steps
- Once a job is triggered by press on the server create a on_[success, failure] callback.
- These callbacks will trigger events / [emit](https://flask-socketio.readthedocs.io/en/latest/api.html#flask_socketio.emit) which let the client know the status of the job.
- This also requires a pub-sub mechanism as socketIo will have to emit these callback events from rq-worker processes.

**Problems caused by the solution**
- Job's have a certain order of being processed once completed this might break for which also needs to be address.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.