hotosm / osm-tasking-manager2

Designed and built for Humanitarian OpenStreetMap Team collaborative emergency/disaster mapping, the OSM Tasking Manager 2.0 divides an area into individual squares that can be rapidly mapped by thousands of volunteers.
http://tasks.hotosm.org
Other
425 stars 156 forks source link

Make scheduler add_job interval configurable #879

Closed batpad closed 7 years ago

batpad commented 8 years ago

Currently, there is the scheduler job that checks for expired tasks every 5 seconds here: https://github.com/hotosm/osm-tasking-manager2/blob/master/osmtm/__init__.py#L160

Would there be any objections to making this configurable? Am happy to PR.

I've found myself wanting to increase this time, especially in an auto-scaling type configuration when there are multiple instances of the app running, and each instance hitting the db every 5 seconds causes a bit of load.

If this is not a common use-case and people don't see the value in making this configurable, please feel free to close :-), but if it seems okay to do, I can go ahead and PR. Thank you!

bgirardot commented 7 years ago

@batpad This seems like a good idea, if you make a pr I think we would be happy to merge it in. Thank you very much!

ethan-nelson commented 7 years ago

added via #897

ethan-nelson commented 7 years ago

Also @batpad if you still run into issues even with a longer time, you could try this solution to ensure it's only running on one instance: https://github.com/hotosm/osm-tasking-manager2/issues/659#issuecomment-213628164