Avoid over-using LDAP connections when decomposing groups

pull/17/head
Ludovic Marcotte 2014-02-14 16:39:26 -05:00
parent ae07de5f6f
commit 75c8362df8
3 changed files with 22 additions and 9 deletions

1
NEWS
View File

@ -45,6 +45,7 @@ Bug fixes
- fixed handling of ACLs on shared calendars with multiple groups (#1854) - fixed handling of ACLs on shared calendars with multiple groups (#1854)
- fixed HTML formatting of appointment notifications for Outlook (#2233) - fixed HTML formatting of appointment notifications for Outlook (#2233)
- replace slashes by dashes in filenames of attachments to avoid a 404 return code (#2537) - replace slashes by dashes in filenames of attachments to avoid a 404 return code (#2537)
- avoid over-using LDAP connections when decomposing groups
2.1.1b (2013-12-04) 2.1.1b (2013-12-04)
------------------- -------------------

View File

@ -1,10 +1,6 @@
/* SOGoCalendarComponent.m - this file is part of SOGo /* SOGoCalendarComponent.m - this file is part of SOGo
* *
* Copyright (C) 2006-2012 Inverse inc. * Copyright (C) 2006-2014 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Francis Lachapelle <flachapelle@inverse.ca>
* Ludovic Marcotte <lmarcotte@inverse.ca>
* *
* This file is free software; you can redistribute it and/or modify * This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,6 +18,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSDictionary.h> #import <Foundation/NSDictionary.h>
#import <Foundation/NSEnumerator.h> #import <Foundation/NSEnumerator.h>
#import <Foundation/NSProcessInfo.h> #import <Foundation/NSProcessInfo.h>
@ -492,18 +489,31 @@
NSMutableArray *allAttendees; NSMutableArray *allAttendees;
iCalPerson *currentAttendee; iCalPerson *currentAttendee;
NSEnumerator *enumerator; NSEnumerator *enumerator;
NSAutoreleasePool *pool;
SOGoGroup *group; SOGoGroup *group;
BOOL eventWasModified; BOOL eventWasModified;
unsigned int i; unsigned int i, j;
domain = [[context activeUser] domain]; domain = [[context activeUser] domain];
organizerEmail = [[theEvent organizer] rfc822Email]; organizerEmail = [[theEvent organizer] rfc822Email];
eventWasModified = NO; eventWasModified = NO;
allAttendees = [NSMutableArray arrayWithArray: [theEvent attendees]]; allAttendees = [NSMutableArray arrayWithArray: [theEvent attendees]];
enumerator = [[theEvent attendees] objectEnumerator]; enumerator = [[theEvent attendees] objectEnumerator];
j = 0;
pool = [[NSAutoreleasePool alloc] init];
while ((currentAttendee = [enumerator nextObject])) while ((currentAttendee = [enumerator nextObject]))
{ {
if (j%5 == 0)
{
RELEASE(pool);
pool = [[NSAutoreleasePool alloc] init];
}
group = [SOGoGroup groupWithEmail: [currentAttendee rfc822Email] group = [SOGoGroup groupWithEmail: [currentAttendee rfc822Email]
inDomain: domain]; inDomain: domain];
if (group) if (group)
@ -547,11 +557,15 @@
eventWasModified = YES; eventWasModified = YES;
} }
} }
j++;
} // while (currentAttendee ... } // while (currentAttendee ...
if (eventWasModified) if (eventWasModified)
[theEvent setAttendees: allAttendees]; [theEvent setAttendees: allAttendees];
RELEASE(pool);
return eventWasModified; return eventWasModified;
} }

View File

@ -1,8 +1,6 @@
/* SOGoGroup.m - this file is part of SOGo /* SOGoGroup.m - this file is part of SOGo
* *
* Copyright (C) 2009-2012 Inverse inc. * Copyright (C) 2009-2014 Inverse inc.
*
* Author: Ludovic Marcotte <lmarcotte@inverse.ca>
* *
* This file is free software; you can redistribute it and/or modify * This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by