@@ -77,7 +77,7 @@ apr_status_t mapcache_connection_pool_create(mapcache_connection_pool **cp, apr_
7777 apr_status_t rv ;
7878 * cp = apr_pcalloc (server_pool , sizeof (mapcache_connection_pool ));
7979 (* cp )-> server_pool = server_pool ;
80- rv = apr_reslist_create (& ((* cp )-> connexions ), 1 , 5 , 200 , 60 * 1000000 ,
80+ rv = apr_reslist_create (& ((* cp )-> connexions ), 1 , 5 , 200 , 60 * 1000000 ,
8181 mapcache_connection_container_creator ,
8282 mapcache_connection_container_destructor ,
8383 NULL ,
@@ -104,8 +104,12 @@ mapcache_pooled_connection* mapcache_connection_pool_get_connection(mapcache_con
104104 while (pc ) {
105105 count ++ ;
106106 if (!strcmp (key ,pc -> private -> key )) {
107- /* move current connection to head of list, and return it */
108- if (pc != pcc -> head ) {
107+ /* move current connection to head of list, and return it. We only move the connection
108+ to the front of the list if it wasn't in the first 2 connections, as in the seeding
109+ case we are always alternating between read and write operations (i.e. potentially
110+ 2 different connections and in that cas we end up switching connections each time
111+ there's an access */
112+ if (pc != pcc -> head && count > 2 ) {
109113 assert (pred );
110114 pred -> private -> next = pc -> private -> next ;
111115 pc -> private -> next = pcc -> head ;
@@ -119,7 +123,9 @@ mapcache_pooled_connection* mapcache_connection_pool_get_connection(mapcache_con
119123
120124 /* connection not found in pool */
121125 pc = calloc (1 ,sizeof (mapcache_pooled_connection ));
126+ /*
122127 ctx->log(ctx, MAPCACHE_DEBUG, "calling constructor for pooled connection (%s)", key);
128+ */
123129 constructor (ctx , & pc -> connection , params , pcc -> pool );
124130 if (GC_HAS_ERROR (ctx )) {
125131 free (pc );
0 commit comments