aboutsummaryrefslogtreecommitdiff
path: root/jobs/basejob.cpp
AgeCommit message (Collapse)Author
2018-02-27Merge branch 'master' into kitsune-gtadKitsune Ral
2018-02-23BaseJob: In case of 4xx errors, fill the status with the message from the ↵Kitsune Ral
response
2018-02-20BaseJob: added Abandoned statusKitsune Ral
For a very brief period between calling BaseJob::abandon() and deletion of the job object.
2018-02-03BaseJob::makeRequestUrlKitsune Ral
A static method that constructs a request URL for this job and the passed set of parameters.
2018-02-03BaseJob::makeRequestUrlKitsune Ral
A static method that constructs a request URL for this job and the passed set of parameters.
2018-01-26Merge branch 'master' into kitsune-gtadKitsune Ral
2018-01-25BaseJob::checkReply: log job returned status more explicitlyKitsune Ral
2018-01-14BaseJob: afterStart(), beforeAbandon(), up/downloadProgress()Kitsune Ral
To support the upcoming DownloadFileJob
2018-01-14BaseJob::Data -> RequestData; support QIODevice* input/outputKitsune Ral
2018-01-14Merge branch 'master' into kitsune-content-repo-create-roomKitsune Ral
2018-01-13Merge branch 'master' into kitsune-gtadKitsune Ral
2018-01-12BaseJob: afterStart(), beforeAbandon(), up/downloadProgress()Kitsune Ral
To support the upcoming DownloadFileJob
2018-01-12BaseJob::Data -> RequestData; support QIODevice* input/outputKitsune Ral
2018-01-12BaseJob::maxRetries: Align the type with that of JobTimeoutConfigKitsune Ral
Fixes some signedness warnings
2018-01-09jobs: expect application/json by default; set query in constructor body; ↵Kitsune Ral
properly convert numbers to strings in query The query should be set in constructor body because there's no reason to pass non-required parameters into the query. As for numbers to strings conversion - there was an attempt to use QJsonValue(a).toString() for that. That doesn't work; QJsonValue does not turn numbers to strings.
2018-01-09BaseJob: Provide a simplified constructorKitsune Ral
2018-01-09BaseJob, MediaThumbnailJob: Support request and response headersKitsune Ral
Enable specifying headers in the request and checking/using headers in the response.
2018-01-09Merge branch 'master' into kitsune-gtadKitsune Ral
2018-01-09BaseJob: change initial job status from NoError to PendingKitsune Ral
Otherwise isJobRunning() is of no great use.
2018-01-05jobs: expect application/json by default; set query in constructor body; ↵Kitsune Ral
properly convert numbers to strings in query The query should be set in constructor body because there's no reason to pass non-required parameters into the query. As for numbers to strings conversion - there was an attempt to use QJsonValue(a).toString() for that. That doesn't work; QJsonValue does not turn numbers to strings.
2018-01-05BaseJob: Provide a simplified constructorKitsune Ral
2018-01-03Support request and response headersKitsune Ral
Enable specifying headers in the request and checking/using headers in the response.
2017-12-31Merge branch 'master' into kitsune-gtadKitsune Ral
2017-12-30BaseJob: do not suppress SSL errorsKitsune Ral
It is the application's responsibility to properly display the error and get confirmation from the user about it.
2017-12-25BaseJob: consolidate job timeout configurationKitsune Ral
This prepares the backend to enable timeouts/retry intervals configurable from clients.
2017-11-28Merge branch 'master' into kitsune-gtadKitsune Ral
2017-11-21Mitigate the mess with slashes between base URL and endpoint stringKitsune Ral
Closes #125
2017-10-27Put access token to headers instead of queryKitsune Ral
2017-10-25Fixed a typo in the logsKitsune Ral
2017-10-19Merge branch 'master' into kitsune-gtadKitsune Ral
2017-10-17Avoid leaking access_token in the logsKitsune Ral
Closes #102.
2017-10-13All jobs: Drop ConnectionData parameter from the constructorKitsune Ral
Having to pass ConnectionData to each and every job class was nothing but boilerplate since the very beginning. Removing it required to prepend BaseJob::start() with ConnectionData-setting code, and to provide a way to alter the request configuration depending on the (late-coming) ConnectionData object. This is a new responsibility of BaseJob::start(); the previous BaseJob::start() contents have moved to BaseJob::sendRequest() (which is now invoked on retries, instead of start()).
2017-10-02All jobs: Drop ConnectionData parameter from the constructorKitsune Ral
Having to pass ConnectionData to each and every job class was nothing but boilerplate since the very beginning. Removing it required to prepend BaseJob::start() with ConnectionData-setting code, and to provide a way to alter the request configuration depending on the (late-coming) ConnectionData object. This is a new responsibility of BaseJob::start(); the previous BaseJob::start() contents have moved to BaseJob::sendRequest() (which is now invoked on retries, instead of start()).
2017-09-22BaseJob: Log the sent request more nicelyKitsune Ral
2017-09-20BaseJob: track the outcome of sendRequest() in the logsKitsune Ral
Also: no reason to start the job timer if the request is not running, so don't even bother.
2017-09-19BaseJob: improved loggingKitsune Ral
Your QT_LOGGING_RULES (especially useful with Qt 5.6 and newer) should work a bit better now: * "Job" prefix is no more needed because the Qt logging prefix (libqmatrixclient.jobs) says it already; * The "created" record didn't follow the logging category if overridden from the concrete job class (see SyncJob); so instead of "created" there's now much more useful "sending request" record.
2017-09-19Fix a race condition leading to a crash on closeKitsune Ral
It seems that some reply processing still might have happened after BaseJob::abandon() (caused in turn by destroying a Connection object), probably because the event from QNetworkReply landed in the event queue after BaseJob::abandon() but before actual deletion of a job object. Now countered by disconnecting from QNetworkReply signals in abandon() and stop().
2017-09-08Revert previous commit as it breaks building with VC 2015Kitsune Ral
This reverts commit da975f68f6a8503bf5466292dcdceed8c6f7fa6f.
2017-09-05Initialize more properly to fix a warningKitsune Ral
2017-05-17Merge pull request #62 from Fxrh/kitsune-refactoringKitsune Ral
Code tweaks and cleanup
2017-05-13Refactored logging enhancementsKitsune Ral
logging.h/logging.cpp is now a full-fledged pair for all things logging. Two more categories added, EPHEMERAL and SYNCJOB, that control logging for ephemeral events and SyncJob, respectively (in particular, switching off EPHEMERAL greatly reduces the logspam about moving read markers and how many users have read up to which event).
2017-05-12BaseJob: Do not leak access token into the job configurationKitsune Ral
Before the access token was added to Private::requestQuery on every sendRequest() invocation, leading to the same access token being added up to the request once more with each retry.
2017-05-09Code cleanup and tweaking (partially driven by clang-tidy)Kitsune Ral
Mainly it's about const-ification (in particular, passing const-refs instead of values) and deleting unneeded declarations/#includes. Since the changes alter the external interface, this is submitted as a PR for peer review. One of unneeded declarations/definitions is a virtual destructor in BaseJob descendants. Since a job object should be deleted through QObject::deleteLater() anyway (and it's the only correct way of disposing of the object), all deletions will call the stack of destructors through virtual QObject::~QObject(). Therefore even BaseJob could get on with a non-virtual destructor but for the sake of clarity BaseJob::~BaseJob() is still declared virtual.
2017-04-30Port to categorized loggingElvis Angelaccio
This greatly reduces the noise made by quaternion. To enable full logging, export the following variable: QT_LOGGING_RULES="libqmatrixclient.*.debug=true"
2017-04-02Renamed JobHttpType to more fitting HttpVerb; removed Job from enum valuesKitsune Ral
2017-03-27Map QNetworkReply::UnknownContentError to BaseJob::IncorrectRequestErrorKitsune Ral
This is what /join returns if I supply garbage for the alias.
2017-03-25Jobs retry on network and timeout errorsKitsune Ral
As of now, the retry logic (see BaseJob::finishJob() method) invokes the same network request several times with increasing timeouts and retry intervals. Some additional signals and accessors are also provided to control the behaviour from inheriting classes (see a notable example with SyncJob in the same commit) and clients (support of retries in Quaternion comes in a respective commit shortly).
2017-03-24BaseJob: Add more error statesKitsune Ral
This should help to provide more reasonable error messages when a particular resource is not found or entered data are outright incorrect.
2016-10-15BaseJob: Use saved parameters instead of overriding apiPath(), query() and ↵Kitsune Ral
data() in each job class
2016-09-11Explicitly stop the timer in finishJob()Kitsune Ral
This should avoid timeout event catching up on a not-yet-deleted-but- already-invalid job object.