File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -262,8 +262,23 @@ ops_keyring_t *OpenPGPSDKHandler::allocateOPSKeyring()
262262
263263void RNPPGPHandler::locked_timeStampKey (const RsPgpId& key_id)
264264{
265- _public_keyring_map[key_id]._time_stamp = time (nullptr );
266- _trustdb_changed = true ;
265+ rstime_t now = time (nullptr );
266+ _public_keyring_map[key_id]._time_stamp = now;
267+
268+ // Only flag the trust database for rewrite once per hour. This function is
269+ // called on every PGP key usage (e.g. VerifySignBin(), which runs on every
270+ // GXS identity validation and every connection). Flagging _trustdb_changed
271+ // on each call caused the whole private trust database (thousands of
272+ // packets) to be rewritten and re-read every few seconds. Updating the
273+ // in-memory usage timestamp on every call is cheap and stays; only the
274+ // on-disk sync is throttled. OpenPGPSDKHandler throttles the same way (see
275+ // openpgpsdkhandler.cc); the rnp port had dropped it.
276+ static rstime_t last_trustdb_update_because_of_stamp = 0 ;
277+ if (now > last_trustdb_update_because_of_stamp + 3600 )
278+ {
279+ _trustdb_changed = true ;
280+ last_trustdb_update_because_of_stamp = now;
281+ }
267282}
268283
269284bool rnp_get_passphrase_cb (rnp_ffi_t /* ffi */ ,
You can’t perform that action at this time.
0 commit comments