ScratchData LogoScratchData
Back to kriblo_test's profile

Cloud Experiment

KRkriblo_test•Created June 22, 2020
Cloud Experiment
1
0
42 views
View on Scratch

Instructions

This project is a working project, used to test cloud variable functionality across accounts. Clicking "Set" generates 10 strings filled with pseudo random numbers and assigns them to 10 cloud variables. The first number in the first variable is a zero padded seed. Clicking "Get" reads the 10 cloud variables, identifies the seed, and checks that all following numbers is in agreement with the pseudo random number generator. Wait between variables, is the time in seconds which the script will wait between (not anymore: both reading and) writing each cloud variable. All code by me (@kriblo).

Description

This project was, among other things, designed to test skipped writes of cloud variables. Particularly in relation to the delay imposed between writing each variable. The more I test (using this account and @kriblo), the more I'm convinced the problem with skipped writes is related to concurrent reads. For instance: - If you write in one account, with a 0.01 second delay, and wait for it to finish before reading in the other account, you very seldom have a problem (you get the correct seed, an no errors). - If you write in one account and simultaneously read in another account, you obviously get an error (here a checksum would be helpful). But more importantly, you often get skipped variables, meaning correct seed but errors in the sequence in the second account, even when the first account has finished writing. - Employing a forever loop in the "reading account", which continuously read cloud variables, resulted in skipped variables, even at delays of 0.2 seconds. This to me suggest that increasing the delay is not the answer. It seems to me there's no way to know if a write is successful. If you set a cloud variable, then read it, it will report the value you just set it to, regardless of whether or not that value is the value currently stored on the cloud server. I even tried setting the variable again before reading (v=join(v,""), see inside). So how would you implement a "cloud in use" cloud variable, and be sure the cloud is locked for you to write?

Project Details

Project ID406910524
CreatedJune 22, 2020
Last ModifiedFebruary 16, 2022
SharedJune 23, 2020
Visibilityvisible
CommentsAllowed