Skip to content

areas created on init and every startup, even with OVERPASS_DIFF_URL empty #158

@XPav

Description

@XPav

I am using a static configuration of overpass with OVERPASS_DIFF_URL set to empty and OVERPASS_USE_AREAS set to true.

When in INIT, osm3s_query --progress --rules is called in docker-entrypoint.sh, and the rules are created.

When not in INIT, rules_loop.sh is called from the supervisor, and it again runs osm3s_query, regardless of current state. It doesn't have to be run again, there are no updates.

This may somewhat be related to #128 and #153 and #154, where it appears that the db is left in an inconsistent state, but I believe a slightly different use case.

For now, since I believe the one-time rules generation is fine, I've edited rules_loop.sh to be

while true; do
	{
        if [[ -z "${OVERPASS_DIFF_URL}" ]]; then
            echo "OVERPASS_DIFF_URL is not set - updates disabled, assuming areas created on init, sleeping forever"
            sleep infinity
        else
            START=$(date +%s)
    		echo "$(date '+%F %T'): update started" >>"$DB_DIR/rules_loop.log"
    		./osm3s_query --progress --rules <"$DB_DIR/rules/areas.osm3s"
    		echo "$(date '+%F %T'): update finished" >>"$DB_DIR/rules_loop.log"
            WORK_TIME=$(($(date +%s) - START))
            SLEEP_TIME=$((WORK_TIME * 100 / CPU_LOAD - WORK_TIME))
            # let SLEEP_TIME be at least 3 seconds
            SLEEP_TIME=$((SLEEP_TIME < 3 ? 3 : SLEEP_TIME))
            echo "It took $WORK_TIME to run the loop. Desired load is: ${CPU_LOAD}%. Sleeping: $SLEEP_TIME"
            sleep "$SLEEP_TIME"
        fi
	}
done

Am I missing something or is this valid change for this use case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions