open-automation / switch-contents-to-private-data

Write file contents to private data.
MIT License
0 stars 0 forks source link

Limit size of PrivateData blob #3

Closed dwightkelly closed 8 years ago

dwightkelly commented 8 years ago

There's a limit to how much data Switch PrivateData blob can contain. Not documented; however, it's a String so probably 255 or 1024 bytes. Check file size and truncate or error if larger than this limit.

dominickp commented 8 years ago

Dwight, did some testing today and wasn't able to reproduce this. Got to 10,000 characters within a PD key and it seems to handle it fine.

function jobArrived( s : Switch, job : Job )
{
    var blob = '';
    var loops = 0;
    var max_loops = 10000;
    var pd_key = "test";

    do {
       blob += "1";    
       job.setPrivateData(pd_key, blob);       
       loops++;

    } while (job.getPrivateData(pd_key) === blob && loops < max_loops);

    s.log(2, "PD value length " + job.getPrivateData(pd_key).length );
    s.log(2, "done, looped " + loops );
}
dwightkelly commented 8 years ago

OK, I didn't know if there was a limit. Just figured it was a string