Skip to content
Permalink
Browse files

Merge branch 'hotfix-10.10.48' into stable

  • Loading branch information...
DominicWatson committed Mar 13, 2019
2 parents 3540e09 + ae46bd1 commit bb2629693b4e23783c48bf83b3689307f8b79648
@@ -406,6 +406,39 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
expect( service.$callLog().removeFromQueue[i] ).toBe( [ emails[i].id ] );
}
} );

it( "should manually clear queue query caches because we are bypassing cache due to running in background thread", function(){
var service = _getService();
var rateLimit = 31;
var emails = [];

for( var i=1; i<=40; i++ ) {
emails.append({
id = CreateUUId()
, template = CreateUUId()
, recipient = CreateUUId()
});
}
emails.append({});

service.$( "$getPresideSetting" ).$args( "email", "ratelimit", 100 ).$results( rateLimit );
service.$( "autoQueueScheduledSendouts", 345 );

var resultsList = "";
for( var i=1; i<=emails.len(); i++ ){
resultsList = resultsList.listAppend( "emails[#i#]" );
}
Evaluate( "service.$( ""getNextQueuedEmail"" ).$results( #resultsList# )" );

mockEmailService.$( "send", true );
service.$( "removeFromQueue", 1 );

service.processQueue();
expect( mockPresideObjectService.$callLog().clearRelatedCaches.len() ).toBe( 5 );
for( var log in mockPresideObjectService.$callLog().clearRelatedCaches ) {
expect( log ).toBe( [ "email_mass_send_queue" ] );
}
} );
} );

describe( "autoQueueScheduledSendouts()", function(){
@@ -515,6 +548,7 @@ component extends="resources.HelperObjects.PresideBddTestCase" {
service.$( "$getPresideObjectService", mockPresideObjectService );
service.$( "$isInterrupted", false );
mockPresideObjectService.$( "getDbAdapterForObject", mockDbAdapter );
mockPresideObjectService.$( "clearRelatedCaches" );

mockDbAdapter.$( "getNowFunctionSql", "nowwweee()" );

@@ -2037,9 +2037,9 @@

super.assertEquals( 0, ArrayLen( cache.getKeys() ), "The cache is not empty, aborting test" );

data.set1 = poService.selectData( objectName="object_b", selectFields=[ "object_a.label as obja" ], filter={ id = objId } );
data.set2 = poService.selectData( objectName="object_b", selectFields=[ "object_a.label as obja" ], filter="object_b.id = :id", filterParams={id=objId} );
data.set3 = poService.selectData( objectName="object_b", selectFields=[ "object_a.label as obja" ], filter="object_b.id = :id", filterParams={id="meh"} );
data.set1 = poService.selectData( objectName="object_b", selectFields=[ "related_to_a.label as obja" ], filter={ id = objId } );
data.set2 = poService.selectData( objectName="object_b", selectFields=[ "related_to_a.label as obja" ], filter="object_b.id = :id", filterParams={id=objId} );
data.set3 = poService.selectData( objectName="object_b", selectFields=[ "related_to_a.label as obja" ], filter="object_b.id = :id", filterParams={id="meh"} );
data.set4 = poService.selectData( objectName="object_b", filter={ id = "meh" } );
data.set5 = poService.selectData( objectName="object_b" );
data.set6 = poService.selectData( objectName="object_a" );
@@ -54,6 +54,7 @@ component {
var processedCount = 0;
var queuedEmail = "";
var emailService = _getEmailService();
var poService = $getPresideObjectService();

do {
queuedEmail = getNextQueuedEmail();
@@ -73,8 +74,12 @@ component {
}

removeFromQueue( queuedEmail.id );
if ( !processedCount mod 10 ) {
poService.clearRelatedCaches( "email_mass_send_queue" );
}
} while( ++processedCount < rateLimit && !$isInterrupted() );

poService.clearRelatedCaches( "email_mass_send_queue" );
}

/**
@@ -2324,6 +2324,7 @@ component displayName="Preside Object Service" {
if ( ArrayLen( objects ) ) {
var cacheMap = _getCacheMap();
for( var relatedObject in objects ) {
relatedObject = _resolveObjectNameFromColumnJoinSyntax( arguments.objectName, relatedObject );
cacheMap[ relatedObject ] = cacheMap[ relatedObject ] ?: {};
cacheMap[ relatedObject ][ arguments.objectName ] = 1;
}

0 comments on commit bb26296

Please sign in to comment.
You can’t perform that action at this time.