If I issue a scripted patch request to my RavenDb via code, is there any way I can discover (with code) if/when the patch request completed?
Update
Specifically I use ScriptedPatchRequest with DatabaseCommands.UpdateByIndex - and I need to ensure that the patch has completed before proceeding.
The synchronous DatabaseCommands.Patch method blocks until the patch has finished running.
The asynchronous AsyncDatabaseCommands.PatchAsync method returns a Task<RavenJObject> that is completed when the patch has finished running, and so can be awaited.
This way, the client API provides both blocking and non-blocking patch request capabilities. The same goes for all other methods on DatabaseCommands and AsyncDatabaseCommands.
TBH I do think the behaviour of Patch commands is documented rather poorly... I only figured it out by experimenting.
DatabaseCommands.UpdateByIndex returns an instance of Operation. You can call WaitForCompletion() on this to, uhm, wait for the operation to complete. There's an async version of this method, too, if that's your preferred flavour.
Related
SonarQube: Enterprise Edition Version 9.2.4 (build 50792)
Sonar client: 4.7.0.2747
Scan is launched for merge request in gitlab. I am requesting coverage for pull request.
Imidietly after scan (using scanner client) is finished I try to get coverage by following call:
http:///api/measures/component?metricKeys=coverage&component=&pullRequest=
I am getting:
404 : “{“errors”:[{“msg”:“Component \u0027u0027 of pull request \u0027\u0027 not found”}]}”
Interestingly if I put some sleep (1 second) after scan is finished and before i do a call to get coverage everything is fine.
It seems it has to do something with the fact that it’s a new pull request and regardless scan is finished and it generates link with results, it still requires some time before it will be possible for the api call i mentioned to be able to return coverage. Also, if i retry the operation(scan and get results) on already existing pull request there are no issues like this.
Could you please elaborate on this issue, is such behavior is expected or maybe there are some other ways I can get coverage right away after the scan is finished without adding any sleeps…
As a side observation under same circumstances if i do scan on new pull request and call another api (/issues/search?) to get list of detected issues and it successfully works without any additional sleeps,
Thank you.
After the call from the scanner client completes, SonarQube executes a "background task" in the project that finalizes the computations of measures. When the background task is complete, your measures will be available. This is why adding a "sleep" appears to work for you. In reality, it's just luck that you're sleeping long enough. The proper way to do this is to either manually check the status of the background task, or use tools that check for the background task completion under the covers.
If you're using Jenkins pipelines, and you have the "webhook" properly configured in SonarQube to notify completion of the background task, then the "waitForQualityGate" pipeline step does this, first checking to see if the task is already complete, and if not, going into a polling loop waiting for it to complete.
The machinery uses the "report-task.txt" file that should be written by the scanner. This is in the form of a Java properties file, but there's only one property in the file that you care about, which is the "ceTaskId" property. That is the id of the background task. You can then make an api call to "/api/ce/task?id=", which returns a block that tells you whether the background task is complete or not.
I try to write into the memory using NvM_Write(); there is a positive response from the UDS.
When I try to read the same block, there is no response and the software goes into det with NvM_PENDING state. I reset and then try to read the same memory block, there is no data in that block (it is just 0x00).
NvM_Write leads to Fee_Write but Fls_Write is never called. Is this a configuration issue?
Debugged and found that Fls_Write is never called. The Nvm, Fee and fls are called once every 5 ms. When I request NvM_Write, the request is put in a queue to be serviced in the future.
Seems to be a problem in your setup. I wonder, if you have a task, that calls NvM_Mainfunction(), Fee_Mainfunction() and Fls_Mainfunction(). NvM handles requests like NvM_ReadBlock() and NvM_WriteBlock() by a Queue, which is worked on by the mainfunctions on task level.
Regarding UDS Service, the request returned a positive response most likely due to the fact, that you used the return value of the NvM_WriteBlock(), which will be E_OK if the request to write was accepted by NvM and put in the NvM Queue. If the request was not accepted it returns E_NOT_OK.
The diagnostic service implementation should actually wait for the NvM_GetErrorStatus(BlockID) return value changing from NVM_REQ_PENDING to return NVM_REQ_OK or something else like NVM_REQ_NOT_OK.
I guess, that your implementation was implemented by hand, because with a proper configuration, the Dcm has a standard behaviour described in requirement SWS_Dcm_00541, just as I have explained above.
It seems that in the Java SDK it is not implemented to delete Operations. The REST API supports it. So I'm wondering if I miss something or if this is the case.
Are there any workaround except using a REST Client to delete Operation(s) in a Java Application?
No, currently not (but feel free to send a pull request with an added method).
As background, operations should usually not be deleted by clients, but instead cycled through their process (pending -> executing -> successful/failed). If you delete an operation, it will be not available anymore and you cannot reproduce what happened on a device at a particular point in time. Deletion is usually taken care of by data retention management.
The easiest way to use an API that is not implemented in the client is calling the rest() method on your platform object.
This will return you the underlaying RestConnector for all API (fully initialised with credentials) and you can execute the calls with it (kind of manually).
My store.sync() can return success:false, and if it does, I would like to use something similar to Ext's failure callback to react to the error appropriately, but I did not find a possibility to use any builtin ST functions for this. sync has neither callback nor success nor failure option available in ST.
What did I overlook?
PS: I did find a workaround for success callback at Why is there no sync callback in Sencha Touch? but I need failure callback.
store.sync() is not where you need to look. Take a look at the proxy. Most likely you are using an Ajax request and that in turn will deliver a detailed success and failure.
I am now calling Ext.data.Model.save() on all Ext.data.Model instances that are dirty. This won't batch everything neatly together, but in 90% of the cases, only one item is edited anyways. The best is that this allows to check for failure on each and every item, and not only on the whole batch.
I was told that if I want to use predis-async, then I will use some kind of async web framework (probably built using https://github.com/reactphp/react). I am currently using Yii.
I was also told that
$client->getEventLoop()->run();
That line will start event loop which won't return after all connections to Redis are terminated and all callbacks are invoked. So that means that this line will be blocking for your code. Try to run following code (the simplest code illustrating Predis Async usage):
$client = new Predis\Async\Client('tcp://127.0.0.1:6379');
$client->set('test', 'value');
$client->getEventLoop()->run();
echo 'END';
END won't be probably displayed for a long time or maybe never, but for sure it will take more than the same operation using non-Async
Predis.
However, my own understanding is that existing PHP system should be able to use Predis Async right out of the box, as a lib. Which means existing PHP system does not need to be on ReactPHP. My idea of using predis async is similar to using mongodb asynchronous
commit. When PHP calls mongodb lib to commit a write operation, it is
asynchronous. Mongodb immediately returns the call rather than waiting for
the write happens first. In this case, mongodb doesn't requires
asynchronous php framework too.
Is it true that
END won't be probably displayed for a long time or maybe never, but
for sure it will take more than the same operation using non-Async
Predis.