09-12-2019, 03:34 PM
(This post was last modified: 09-12-2019, 03:37 PM by simon.schvartzman.)
(09-11-2019, 11:28 PM)mark_talluto Wrote:Hi Mark, please see below my code and the results I got(09-11-2019, 12:42 AM)simon.schvartzman Wrote: Hi team, here i go again...
I understand that if I get an answer from calling cdb_ping("tablename") then "tablename" is properly loaded and I can work with it.
Question is what happens if:
1 - there is no internet connection when I call cdb_ping("tablename").
2 - there is internet connection but for some reason "tablename" has not been loaded.
I've tried the following code
[b]put cdb_ping("tablename") into aux
answer cdb_result("response") [/b]
and in both cases the program seems to get stuck on the cdb_ping function and never reaches cdb_result
As a corollary is there any way to find out if a table isn't loaded?
Many thanks
Hi Simon,
Calling cdb_ping(tableName) resolves your tableName validity using underlying methods. Thus, you can not rely on this to verify that you have loaded a table or not.
I would suggest trying cdb_pingNode(). This API talks to the droplet at the lowest level. It is expected to be much faster than cdb_ping() because it does not interrogate the instance. cdb_pingNode() communicates with the droplet only.
- If there is no internet connection while calling cdb_ping(), you receive a response of 'No internet available at this time.' There is no delay on this error.
- If there is an internet connection, and the table has not been loaded, cdb_ping() reports the response time from the instance that is managing your table.
We are trying to see what your hard communication time to the region is. Please report back what you get.
on mouseUp
put ""
initializeCanelaDB
put cdb_auth("xxx@xxx.com","xxxx","xxxxx") into aux
cdb_loadTable ("Notifications")
put the milliseconds into aux
repeat 5
put msg & crlf & "cdb_pingNode(): " & cdb_pingNode("Notifications")
put msg & crlf & "cdb_ping(Notifications): "& cdb_ping("Notifications")
put msg & crlf & "---------"
end repeat
put msg & crlf & "Total elapsed time: " & the milliseconds - aux
end mouseUp
Quote:cdb_ping(Notifications): 974.174023
---------
cdb_pingNode():
cdb_ping(Notifications): 1320.114136
---------
cdb_pingNode():
cdb_ping(Notifications): 857.040882
---------
cdb_pingNode():
cdb_ping(Notifications): 830.114841
---------
cdb_pingNode():
cdb_ping(Notifications): 843.634129
---------
Total elapsed time: 60135
and now replacing cdb_pingNode() by cdb_pingNode("Notifications")
Quote:cdb_pingNode(Notifications): false
cdb_ping(Notifications): 1350.273132
---------
cdb_pingNode(Notifications): false
cdb_ping(Notifications): 1022.816896
---------
cdb_pingNode(Notifications): false
cdb_ping(Notifications): 1668.47682
---------
cdb_pingNode(Notifications): false
cdb_ping(Notifications): 978.23596
---------
cdb_pingNode(Notifications): false
cdb_ping(Notifications): 1000.462055
---------
Total elapsed time: 6312
I'm having a hard time to understand:
1 - why cdb_pingNode() returns nothing
2 - why cdb_pingNode("Notifications") returns false
3 - the response time variations of cdb_ping("Notifications") from a min of 830.114841 to a max of 1668.47682 ( 2x the min)
Am I doing something wrong?
To ";" or not to ";" that is the question