Rails reload dynamic routes on multiple instances/servers

前端 未结 2 1126
花落未央
花落未央 2021-01-14 01:09

How can we force Rails to reload_routes on multiple servers/instances?

We have a multi-tenant platform in Google App-Engine running on 5+ instances and we want all

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-14 01:49

    Assuming you have no shared storage: You could write an action that reloads the route for that particular instance. When you trigger DynamicRoutes::reload, you would make a request to the other instances' reload action.

    If you do have shared storage, write a before_action that reloads the routes whenever a specific file has been "touched" and touch that file if you want to have all instances reload the routes.

提交回复
热议问题