same queries executed more than once:

workflow_get_workflow_for_type: SELECT wid FROM workflow_type_map WHERE type = '$type'
_workflow_creation_state: SELECT sid FROM workflow_states WHERE wid=0 AND sysid=$sysid

CommentFileSizeAuthor
#5 workflow_8.patch871 bytesbaldwinlouie
#1 workflow_7.patch907 bytesbaldwinlouie

Comments

baldwinlouie’s picture

Status: Active » Needs review
StatusFileSize
new907 bytes

I've created a quick patch that simply caches the results of these two queries in a static variable.

Please help in testing this patch.

jmiccolis’s picture

I've noticed the same issue, and the above patch looks reasonable to me - however I'm not too familiar with the internals of the workflow module. Are there any reasons not to do a simple static cache like this?

JacobSingh’s picture

Patch looks okay, however your variable naming is odd. You are setting $results['wid'] to the $sid. Also, I'd say for the sake of clarity, don't use the $results array unless absolutely needed. It doesn't seem to add value here.

Best,
Jacob

JacobSingh’s picture

Priority: Normal » Minor
Status: Needs review » Needs work

Please take a look at the above and re-submit, we'll get it into the next revision.

baldwinlouie’s picture

Status: Needs work » Needs review
StatusFileSize
new871 bytes

renamed the $results variable to $cache and also removed the explicit array initialization. Let me know if there are other things that needs changing.

JacobSingh’s picture

Status: Needs review » Patch (to be ported)

Thanks! Looks good. I'm putting it in

deekayen’s picture

Status: Patch (to be ported) » Fixed

This is in 6.x-1.1.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.