Bug 349893 - Swapfile synced on every keystroke
Summary: Swapfile synced on every keystroke
Status: RESOLVED DUPLICATE of bug 348159
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.0.0
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-04 13:00 UTC by pbs3141
Modified: 2015-07-11 14:03 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pbs3141 2015-07-04 13:00:48 UTC
Reproducible: Always

Steps to Reproduce:
1. Open a document that exists on disk.
2. Enable swapfile, set sync timeout to 15 sec.
3. Hold down a key.

Actual Results:  
Hard disk thrashing noise, because swapfile is constantly being synced. Can confirm using IO monitoring tools, for example. /proc/sys/vm/block_dump.


swapSyncInterval() is measured in seconds, but is passed to QTimer::start as the msecs argument.

swapfile/kateswapfile.cpp:
-syncTimer()->start(m_document->config()->swapSyncInterval());
+syncTimer()->start(m_document->config()->swapSyncInterval() * 1000);

The value was previously hard-coded to 15 sec.
syncTimer()->start(15000);
Comment 1 Christoph Cullmann 2015-07-11 14:03:41 UTC
it commit 034f0a9babf28b5d4719a9695066e855186e6cf0 by Christoph Cullmann.
Committed on 08/06/2015 at 18:40.
Pushed by cullmann into branch 'master'.

fix problem with lockups, wrong time unit ms vs. s for swrap file saving
BUG: 348159

M  +2    -1    src/swapfile/kateswapfile.cpp

http://commits.kde.org/ktexteditor/034f0a9babf28b5d4719a9695066e855186e6cf0

diff --git a/src/swapfile/kateswapfile.cpp b/src/swapfile/kateswapfile.cpp
index 8ec3ac2..e91fc55 100644
--- a/src/swapfile/kateswapfile.cpp
+++ b/src/swapfile/kateswapfile.cpp
@@ -464,7 +464,8 @@ void SwapFile::finishEditing()
     // write the file to the disk every 15 seconds (default)
     // skip this if we disabled that
     if (m_document->config()->swapSyncInterval() != 0 && !syncTimer()->isActive()) {
-        syncTimer()->start(m_document->config()->swapSyncInterval());
+        // important: we store the interval as seconds, start wants milliseconds!
+        syncTimer()->start(m_document->config()->swapSyncInterval() * 1000);
     }
 
     // format: qint8

*** This bug has been marked as a duplicate of bug 348159 ***