Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-12765

Speed improvement to ezMutex

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Obsolete
    • Icon: Medium Medium
    • None
    • 3.10.0, 3.9.4, 4.0.0
    • None

    Description

      function lock() does a ClearMeta and a SetMeta in a row. This involves creating 2 tmp files and 2 file renames, while one would be enough.

      Patch:

      • add a 3rd param to SetMeta: $clear=false
      • if $clear !== false, do not unserialize $this->currentFileName
      • lock calls setMeta( 'timestamp', time(), true )
            function setMeta( $key, $value, $clear=false)
            {
                $tmpFile = $this->MetaFileName . substr( md5( mt_rand() ), 0, 8 );
                if ( $clear !== false && file_exists( $this->MetaFileName ) )
                {
                    $content = unserialize( eZFile::getContents( $this->MetaFileName ) );
                }
                else
                {
                    $content = array();
                }
                $content[$key] = $value;
                eZFile::create( $tmpFile, false, serialize( $content) );
                eZFile::rename( $tmpFile, $this->MetaFileName );
            }
        

      Attachments

        Activity

          People

            unknown unknown
            72f8acac-185f-4a54-9470-a7473f50daab@accounts.ibexa.co Gaetano Giunta
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: