Plugin Directory

Changeset 2134141


Ignore:
Timestamp:
08/05/2019 10:50:39 AM (7 years ago)
Author:
Will Brownsberger
Message:

4.4.1.1 pretest

Location:
wp-issues-crm/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-issues-crm/trunk/php/entity/class-wic-entity-email-activesync-synch.php

    r2134115 r2134141  
    6666            $client = $response['output'];
    6767        }
     68
     69        // time stamp for connection setup completed -- reporting purposes only -- show connection speed and collect results of this run in inbox
     70        $synch_fetch_time = microtime(true);
     71        $synch_fetch_time_stamp = floor( $synch_fetch_time );
     72       
    6873        WIC_Entity_Email_Cron::log_mail ( "WIC_Entity_Email_ActiveSync_Synch::synch_inbox -- connection initiated for timestamp $synch_fetch_time_stamp -- folder $folder. ");
    6974
     75        // set up temporary table to capture download of message_ids
     76        $temporary_table = '';
     77        $result = self::create_temporary_staging_table ( $synch_fetch_time_stamp );
     78        if ( !$result['response_code'] ) {
     79            return $result;
     80        } else {
     81            $temporary_table = $result['output'];
     82        }
     83
    7084        // attempt to lock inbox before deciding whether full or partial synch -- this forces wait for last synch to complete and set processing flag in overrun situation
    71         self::lock_inbox();
     85        self::lock_inbox( $temporary_table );
    7286       
    7387        // get folder from main router 
     
    87101        }
    88102
    89         WIC_Entity_Email_Cron::log_mail ( "WIC_Entity_Email_ActiveSync_Synch::synch_inbox -- starting with uid_reservation table locked" . ( !$sync_start ? 'full' : 'update/partial'  ) . " synch for $folder. ");
    90 
    91 
    92         // time stamp for connection setup completed -- reporting purposes only -- show connection speed and collect results of this run in inbox
    93         $synch_fetch_time = microtime(true);
    94         $synch_fetch_time_stamp = floor( $synch_fetch_time );
    95         $num_msgs = false;
     103        WIC_Entity_Email_Cron::log_mail ( "WIC_Entity_Email_ActiveSync_Synch::synch_inbox -- starting with inbox table locked" . ( !$sync_start ? 'full' : 'update/partial'  ) . " synch for $folder. ");
     104
     105
    96106        /*
    97107        *
     
    99109        *
    100110        */
     111        $num_msgs = false;
    101112        // Build the request -- properties requested
    102113        $request = new GetFolderType();
     
    132143        self::save_stub_log_entry( $folder, $synch_fetch_time_stamp, $num_msgs );
    133144   
    134         // set up temporary table to capture download of message_ids
    135         $temporary_table = '';
    136         $result = self::create_temporary_staging_table ( $synch_fetch_time_stamp );
    137         if ( !$result['response_code'] ) {
    138             self::unlock_inbox();
    139             return $result;
    140         } else {
    141             $temporary_table = $result['output'];
    142         }
    143 
    144145        // actually go out to activesync and get the records
    145146        $result = self::populate_temporary_staging_table ( $folder, $synch_fetch_time_stamp, $client, $temporary_table, $sync_start );
     
    517518
    518519
    519     // don't actually lock inbox; lock the uid_reservation_table which holds back any inbox processing.
    520     protected static function lock_inbox () {
    521        
    522         global $wpdb;
    523         $uid_reservation_table = $wpdb->prefix . 'wic_uid_reservation';
     520    protected static function lock_inbox ( $temporary_table ) {
     521       
     522        global $wpdb;
     523        $inbox_table = $wpdb->prefix . 'wic_inbox_image';
    524524
    525525        $locked = $wpdb->query (
    526526            "
    527             LOCK TABLES $uid_reservation_table WRITE
    528             "
     527            LOCK TABLES $inbox_table WRITE, $inbox_table as i2 READ, $temporary_table READ
     528            "
    529529        );
    530530        if ( false === $locked ) {
  • wp-issues-crm/trunk/readme.txt

    r2134115 r2134141  
    108108
    109109== Changelog ==
     110= 4.4.1.1 =
     111* Further modify locking behavior in ActiveSync inbox synch
    110112= 4.4.1 =
    111113* Modify locking behavior in ActiveSync inbox synch to prevent process conflicts in overlapping cron runs for large inboxes
Note: See TracChangeset for help on using the changeset viewer.