dovecot-2.2: push-notification: Cache the metadata lookup in OX ...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Oct 1 09:50:53 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/7cbb955a3d44
changeset: 19266:7cbb955a3d44
user: Timo Sirainen <tss at iki.fi>
date: Thu Oct 01 12:49:25 2015 +0300
description:
push-notification: Cache the metadata lookup in OX driver.
diffstat:
src/plugins/push-notification/push-notification-driver-ox.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diffs (38 lines):
diff -r a67e667f38a9 -r 7cbb955a3d44 src/plugins/push-notification/push-notification-driver-ox.c
--- a/src/plugins/push-notification/push-notification-driver-ox.c Thu Oct 01 12:34:43 2015 +0300
+++ b/src/plugins/push-notification/push-notification-driver-ox.c Thu Oct 01 12:49:25 2015 +0300
@@ -37,6 +37,7 @@
/* This is data specific to an OX driver. */
struct push_notification_driver_ox_config {
struct http_url *http_url;
+ const char *cached_ox_metadata;
};
/* This is data specific to an OX driver transaction. */
@@ -97,6 +98,7 @@
static const char *push_notification_driver_ox_get_metadata
(struct push_notification_driver_txn *dtxn)
{
+ struct push_notification_driver_ox_config *dconfig = dtxn->duser->context;
struct mail_attribute_value attr;
struct mailbox *inbox;
struct mailbox_transaction_context *mctx = NULL;
@@ -104,6 +106,9 @@
bool success = FALSE, use_existing_txn = FALSE;
int ret;
+ if (dconfig->cached_ox_metadata != NULL)
+ return dconfig->cached_ox_metadata;
+
/* Get canonical INBOX, where private server-level metadata is stored.
* See imap/cmd-getmetadata.c */
if ((dtxn->ptxn->t != NULL) && dtxn->ptxn->mbox->inbox_user) {
@@ -146,6 +151,8 @@
mailbox_free(&inbox);
}
+ dconfig->cached_ox_metadata =
+ p_strdup(dtxn->ptxn->puser->driverlist->pool, attr.value);
return (success == TRUE) ? attr.value : NULL;
}
More information about the dovecot-cvs
mailing list