CanalPlanAC

Circular Maps

Although missing ones will be generated when people visit pages, it's good to avoid this in general. May 2022 subsystem made to refresh maps as needed.

It is built from the following components

The map generation page

This is a HTML page with all the code in JS. It calls out to the API and gets a set of maps to draw, draws them, and uploads the results (using callback.cgi). If that works it gets some more, if there are none to fetch it sleeps for a while.

It runs in a headless version of Chrome.

The API notes when it was last polled, and if it's not run recently the background processor starts up the headless Chrome to do the work.

The database table

There is a simple table in the MySQL database that acts as queue (and is called circle_map_queue). If you want to draw a map, say to refresh it, you just write it to the queue. Contains six fields:

CREATE TABLE circle_map_queue (item_no INTEGER AUTO_INCREMENT KEY, added DATETIME DEFAULT CURRENT_TIMESTAMP, type TEXT, id TEXT, style TEXT, reason TEXT);

The API [DONE]

Another feature in api.cgi - should be pretty obvious what it does from above: fetches a number of items from the queue and sends them in JSON

The Script [DONE]

A script in build/scripts called find_missing_circle_maps.can which checks every location for missing maps and adds them to the queue

The Idle_Time process