gitcoinco / gitcoinco/grants-stack-qf-calculator

Create a secondary process that runs a loop checking for new calculations jobs

Open
#10 0 comments 0 reactions 0 assignees View on GitHub
engineering
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

* add the configuration to run it in docker and in the fly deployment
* it sleeps N seconds or minutes to be decided (add it as env var)
* it select the next job querying the results table with the following conditions:
* the oldest `last_requested_at`
* that wasn't performed: where `last_requested_at > generated_at`
* and it's not running now: `finished_at is not null`
* update `started_at` to `now`
* update `finished_at` to `null`
* perform the select/update in one single query locking the record or table to avoid race conditions

Call a `perform_matching_calculation(chain_id, round_id)` dummy function that returns a dummy url

* update the result record:
* update the `finished_at` column to `now`
* update the `generated` column to `now`
* update the `file_url` column with the URL returned from the function

we will add a separate queue in the future if we need to scale it and have multiple jobs running concurrently

Contributor guide

No contributing guide indexed for this repository

Research direction

No files or tests are named. Start by locating the results table, the job-processing entry point, and the Docker and Fly deployment configuration; then verify the environment-controlled polling interval and atomic record locking. Done means the process claims eligible jobs safely, calls the dummy calculation function, and updates the result fields with completion time, generated time, and file URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker
Domain
backend, databases, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.