rebuildTermSearchKey should wait for slaves.

rebuildTermSearchKey should sleep if slaves get lagged, in order
to avoid locking the database because slaves get too far behind.

Change-Id: I9eb2735b688f80e7319c2b73c56cbf6c1ba54fcc
Note: This should be backported to the wmf12 branch.
Merge "rebuildTermSearchKey should wait for slaves."