I'm using DropNetRT and I'm executing this code:
api.UseSandbox = true;
await api.GetMetaData("/");
It never returns from the GetMetadata function. All my other calls (i.e. GetDelta, Upload, GetFile) all work. Any direction you can give me would be appreciate.
Related
So I'm using lambda to run a Flask-Ask app and right now I'm having trouble retrieving data from the parameter store. When I run my function from VS it runs fine, and has no problem retrieving a parameter.
this is piece of code causing my troubles
#app.route("/test")
def test():
try:
URL_var = client.get_parameter(Name="URL")
return str(URL_var['Parameter']['Value'])
except Exception as e:
track = traceback.format_exc()
return track
Once its actually running on AWS the problems start.
Initially the page would just timeout when I tried to retrieve or put a parameter, so I configured it so connect_timeout and read_timeout were both equal to 5, and then I put the code in a try except block. Now what I get is a stack trace that really only tells me that the function timed out.
What I need is some way to know whats going wrong when I call get_parameter so I can figure out where to go from here.
I am learning ES6 Proxy, and try to understand param 'receiver' in a get trap, so I tried to console.log the receiver value. But when run in nodeJS, it causes an error:
RangeError: Maximum call stack size exceeded
let proxy = new Proxy({}, {
get (target, key, receiver) {
console.log('receiver:', receiver)
}
})
let obj = Object.create(proxy)
console.log(obj)
I want to know what is causing this error, and how to test receiver's reference in different situations.
The receiver in get (target, key, receiver) refers to the Proxy object, so you create an endless loop.
console.log(obj) tries to log the contents of obj, so it is iterating over all its keys, and retrieves their value. To get their value, the get of the Proxy is invoked, and in that get you have console.log('receiver:', receiver), and there receiver refers to obj, so again it tries to log the contents of obj, … which results in an endless recursive loop.
If you want to understand the param receiver in a get trap then you should not use logging, but the debugger, breakpoints, and the variable inspector in the debugger.
I hope that the following code will help to solve your problem.
let proxy = new Proxy({}, {
get: function (target, key, receiver) {
console.log('receiver:' + receiver);
}
});
let obj = Object.create(proxy);
console.log(obj);
Here you have create a Proxy object and it makes an infinite loop which never ends.
This error (maximum call stack trace exceed) means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you hit the call stack limit. This is almost always because of a recursive function with a base case that isn't being met.
+(string concatenation operator) with object will call the toString method on the object and a string will be returned. So, '' + object is equivalent to object.toString(). And toString on object returns "[object Object]".
With , the object is passed as separate argument to the log method. So, this takes much time to provide arguments to the console log by sepertely and makes a "maximum call stack trace exceed" error.
So according to me I hope that this shold be the issue.
I have a test which in which I check retry mechanism for token authorisation. Inside that test I return null as token in the beginning and then I return a valid token, like this:
whenever(accountManager.getToken())
.thenReturn(null)
.thenReturn("some_token")
Then I have an Observable:
return Observable.just(accountManager.getToken())
...
.retryWhen { retryOnAuthExceptionWithBackoff(it) }
It should get the token, send it somewhere, wait for response and then it the response is wrong, retry the whole process again until it succeeds.
The problem is that when retryWhen() kicks in, the source observable is not called again, just its initial value is returned immediately.
On the other hand, this does work:
return Observable.just(null)
.map{ accountManager.getToken() }
...
.retryWhen { retryOnAuthExceptionWithBackoff(it) }
Is it by design or is it a bug? If it's by design, what would be an elegant way to write this, because Observable.just(null) looks just ugly.
The just() takes a constant value reference and keeps handing out the same reference to subscribers.
What you need is fromCallable:
Observable.fromCallable(() -> accountManager.getToken())
...
Whenever a new subscriber (such as a retry) comes in, the lambda is executed again.
I am going to use WUA API and begin execution of an asynchronous search for updates in this way:
CComPtr<SearchCallbackImpl> iscc_; <<-- Note you need to CreateInstance
CComPtr<ISearchJob> pUpJob_;
pUpJob_ = NULL;
pUpSearcher_->BeginSearch(
CComVariant(criteria.c_str()).bstrVal,
iscc_,
CComVariant(L"Scanning"),
&pUpJob_);
When I need to stop my program, but ISearchJob has not completed yet, I use this code:
if (pUpJob_)
{
CComVariant isStopped;
pUpJob_->get_IsCompleted(&isStopped.boolVal);
if (isStopped.boolVal == VARIANT_FALSE)
{
if (SUCCEEDED(pUpJob_->RequestAbort()))
{
pUpJob_->CleanUp();
pUpJob_.Release();
}
}
}
Generally this code works but sometime it hangs on pUpJob_->CleanUp(); and I do not have ability to stop my programm correctly.
So my questions are:
What is the correct way to stop asynchronous search job for updates?
Also i misunderstood what is difference between ISearchJob::CleanUp and ISearchJob::RequestAbort and how to use this methods to stop asynchronous search correctly?
Should this methods be used together or separately?
RequestAbort() is also asynchronous (the hint to that is in the name). After calling it, you should call pUpSearcher_->EndSearch(); it will return an ISearchResult with ResultCode equal to orcAborted if the abort was successful. Then you can free your resources.
I'm not fully sure how CleanUp() is supposed to be used, but this page seems to imply it's intended for scripts that have callbacks, and that you're not supposed to call CleanUp() from within a callback. Not sure where your code for cancelling is run.
I have a piece of code which makes multiple nested calls to FB.api to retrieve certain information. Eventually, it creates an object called "myfriends" and stores my desired information in that object.
What I want to do is to use that object, after it is filled in with data (i.e. after all asynch calls are done), to run something else. In other words, I need a way for my code to know that those calls are complete. How can I do that?
call 'myfriends' after async request has completed.
Example:
FB.api('/me', function(response) {
alert('Your name is ' + response.name);
// Use 'myfriends' object here
});
I ended up using callback functions. The other problem I had was that my inner API call was in a loop; I ended up using an asynchronous looping function. This combination solved my problem.