刷新缓存来更新与当前会话相关的订阅,flush-subscriptions命令确保Watchman收到的是最新的信息

订阅的更新

Subscription updates will be interleaved between theflush-subscriptionsrequest and its response. Once the response has been received, subscriptions are up-to-date.

此命令被设计为具有后台进程或守护程序的交互式程序使用,以保持对订阅服务器的订阅

This command is designed to be used by interactive programs that have a background process or daemon maintaining a subscription to Watchman. The typical pattern is for interactive commands to be forwarded to the process, which callsflush-subscriptionsand then processes any subscription updates it received. This pattern eliminates races with files changed right before the interactive command.

参数

  • sync_timeout 必须. The number of milliseconds to wait to observe a synchronization cookie. The synchronization cookie is created at the start of the flush-subscriptionscall, and once the cookie is observed, means that the OS has sent watchman all the updates till at least the start of theflush-subscriptionscall.
  • subscriptions 可选.表明哪个订阅要被刷新. 默认情况下,将刷新与此会话相关的所有订阅。

示例

Assuming subscriptionssub1,sub2andsub3have been established on this session, ifsub1has updates pending,sub2is up-to-date andsub3is currently dropping updates:

["flush-subscriptions","/path/to/root",{"sync_timeout":1000}]

In response, Watchman will first emit a unilateral subscription PDU forsub1, then respond with

{"clock":"c:1446410081:18462:7:135","synced":["sub1"],"no_sync_needed":["sub2"],"dropped":["sub3"]}

To flush updates for some but not all subscriptions associated with this session:

["flush-subscriptions","/path/to/root",{"sync_timeout":1000,"subscriptions":["sub1","sub2"]}]

Deferred and Dropped Updates

Subscriptions will typically buffer individual updates until a_settle_period has expired.flush-subscriptionswill force those updates through immediately.

Subscriptions currently deferring updates because ofdeferordefer_vcsare updated immediately, without waiting for thedeferordefer_vcsto end.

Subscriptions currently dropping updates with adropstate will not get any updates. Their names will be returned in thedroppedfield.

Notes

  • flush-subscriptions can only be used to flush subscriptions associated with the current session.
  • A single session can be subscribed to updates from multiple projects at the same time. However, flush-subscriptions can only flush updates for one project at a time

results matching ""

    No results matching ""