Skip to content

Commit

Permalink
CleanupPollsJobs: Preserve more journal data
Browse files Browse the repository at this point in the history
  • Loading branch information
ckamm committed Nov 10, 2015
1 parent 4b5c3d8 commit 8f7dbe7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/libsync/owncloudpropagator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,8 @@ void CleanupPollsJob::start()

auto info = _pollInfos.first();
_pollInfos.pop_front();
SyncFileItemPtr item(new SyncFileItem);
item->_file = info._file;
item->_modtime = info._modtime;
SyncFileItemPtr item(new SyncFileItem(
_journal->getFileRecord(info._file).toSyncFileItem()));
PollJob *job = new PollJob(_account, info._url, item, _journal, _localPath, this);
connect(job, SIGNAL(finishedSignal()), SLOT(slotPollFinished()));
job->start();
Expand Down
18 changes: 18 additions & 0 deletions src/libsync/syncjournalfilerecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,24 @@ SyncJournalFileRecord::SyncJournalFileRecord(const SyncFileItem &item, const QSt

}

SyncFileItem SyncJournalFileRecord::toSyncFileItem()
{
SyncFileItem item;
item._file = _path;
item._inode = _inode;
item._modtime = Utility::qDateTimeToTime_t(_modtime);
item._type = static_cast<SyncFileItem::Type>(_type);
item._etag = _etag;
item._fileId = _fileId;
item._size = _fileSize;
item._remotePerm = _remotePerm;
// item has no _mode
item._serverHasIgnoredFiles = _serverHasIgnoredFiles;
item._transmissionChecksum = _transmissionChecksum;
item._transmissionChecksumType = _transmissionChecksumType;
return item;
}

static time_t getMinBlacklistTime()
{
return qMax(qgetenv("OWNCLOUD_BLACKLIST_TIME_MIN").toInt(),
Expand Down
9 changes: 9 additions & 0 deletions src/libsync/syncjournalfilerecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@ class OWNCLOUDSYNC_EXPORT SyncJournalFileRecord
{
public:
SyncJournalFileRecord();

/// Creates a record from an existing item while updating the inode
SyncJournalFileRecord(const SyncFileItem&, const QString &localFileName);

/** Creates a basic SyncFileItem from the record
*
* This is intended in particular for read-update-write cycles that need
* to go through a a SyncFileItem, like PollJob.
*/
SyncFileItem toSyncFileItem();

bool isValid() {
return !_path.isEmpty();
}
Expand Down

0 comments on commit 8f7dbe7

Please sign in to comment.