Changeset 2134141
- Timestamp:
- 08/05/2019 10:50:39 AM (7 years ago)
- Location:
- wp-issues-crm/trunk
- Files:
-
- 2 edited
-
php/entity/class-wic-entity-email-activesync-synch.php (modified) (5 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-issues-crm/trunk/php/entity/class-wic-entity-email-activesync-synch.php
r2134115 r2134141 66 66 $client = $response['output']; 67 67 } 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 68 73 WIC_Entity_Email_Cron::log_mail ( "WIC_Entity_Email_ActiveSync_Synch::synch_inbox -- connection initiated for timestamp $synch_fetch_time_stamp -- folder $folder. "); 69 74 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 70 84 // 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 ); 72 86 73 87 // get folder from main router … … 87 101 } 88 102 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 96 106 /* 97 107 * … … 99 109 * 100 110 */ 111 $num_msgs = false; 101 112 // Build the request -- properties requested 102 113 $request = new GetFolderType(); … … 132 143 self::save_stub_log_entry( $folder, $synch_fetch_time_stamp, $num_msgs ); 133 144 134 // set up temporary table to capture download of message_ids135 $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 144 145 // actually go out to activesync and get the records 145 146 $result = self::populate_temporary_staging_table ( $folder, $synch_fetch_time_stamp, $client, $temporary_table, $sync_start ); … … 517 518 518 519 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'; 524 524 525 525 $locked = $wpdb->query ( 526 526 " 527 LOCK TABLES $uid_reservation_table WRITE 528 "527 LOCK TABLES $inbox_table WRITE, $inbox_table as i2 READ, $temporary_table READ 528 " 529 529 ); 530 530 if ( false === $locked ) { -
wp-issues-crm/trunk/readme.txt
r2134115 r2134141 108 108 109 109 == Changelog == 110 = 4.4.1.1 = 111 * Further modify locking behavior in ActiveSync inbox synch 110 112 = 4.4.1 = 111 113 * 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.