Programmers of STEEM, Mind Lending KLYE Some of Your Mind?

Hail fellow code wizards. Writing this post today in hopes of collecting the right information / logic / computer words to fix an issue I've been having with my Tippy project currently being developed.

Basically my service is 90% coded functionality wise at this point! But one seemingly daunting problem I've had on it is developing a queue system for voting and comment replies to skirt the 3 and 20 seconds limits imposed by the STEEM blockchain.

What I'm looking for is a function using steemjs module capability that takes in the following variables, checks to see if we're currently waiting for a 20 second post limit or 3 second vote limit, enqueues the comment or vote for later if finds it's delayed and follows a FiFo (First in, First Out) style of processing what's thrown at it.

Variables that must be digested. and enqueued for sending ASAP:

  • wif
  • parentAuthor
  • parentPermlink
  • tippy (bot name variable)
  • permlink
  • title
  • content
  • metadata
  • block

I'll share my current code below that I'm using.. While it "sort of" works unfortunately I've been unable to get the function to work as I'd hoped, and thus am asking the community of coders here on Steemit to have a look over what I have and offer their thoughts or methods on achieving what I've been struggling with.

function commentQueue() {
    this.elements = [];
        };
        // enqueue a new thingy
        commentQueue.prototype.enqueue = function (e) {
            this.elements.push(e);
        };
        // remove an element from the front of the queue
        commentQueue.prototype.dequeue = function () {
            return this.elements.shift();
        };
        // check if the queue is empty
        commentQueue.prototype.isEmpty = function () {
            return this.elements.length == 0;
        };
        // get the element at the front of the queue
        commentQueue.prototype.peek = function () {
            return !this.isEmpty() ? this.elements[0] : undefined;
        };
        var qc = new commentQueue();
        var cr;
    var timetimetime = 1000;

function countdown() {
                    count = 19;
                    if (count >= 0){
    var timerId = setInterval(function() {
                console.log("║".blue + logo + " W ".blue.dim + "WAIT".grey.dim + " │ ".blue + count + "s on Post Limiter");
        count--;
        if(count <= 0) {
                // your code goes here
                clearInterval(timerId);
                count = 0;
                commentwait = false;
                 timetimetime = 1000;
        }
    }, timetimetime);
};
}

var counttime = parseFloat(count + "000");
// counttime = (count * 1000);

//----- Reply to comment function
var replycomment = function (wif, parentAuthor, parentPermlink, tippy, permlink, title, content, metadata, block) {
        if (debugmode == true) {
            console.log("║".blue + logo + " ~ DBUG".magenta.dim + " │ ".blue + "function ".magenta.dim + "replycomment".blue.bold + "(".white.dim + wif + "," + parentAuthor + "," + parentPermlink + "," + tippy + "," + permlink + "," + title + "," + content + "," + metadata + "," + block + ")".white.dim);
        };
        if(commentwait == false){
            steem.broadcast.comment(wif, parentAuthor, parentPermlink, tippy, permlink, title, content, metadata, function (commentfailz, commentwinz) {
                if (commentfailz) {
                    if (debugmode == true) {
                        console.log(commentfailz);
                    };
                    console.log("║".blue + logo + " W ".yellow.dim + "WAIT".yellow + " │ ".blue + "Waiting on Comment Limiter to F**k Off!");

                        setTimeout(function() {
                            // Load first op without removing
                        steem.broadcast.comment(wif, parentAuthor, parentPermlink, tippy, permlink, title, content, metadata, function (errqc, winqc) {
                            if(errqc){

                            }
                            if(winqc){
                                console.log("║".blue + logo + " > ".green.bold + "SEND".green.bold + " │ ".blue + time + "@" + parentAuthor + "'s Response Sent on Block #" + headstreamblock);
                                countdown();
                            }
                        });
                        }, counttime)
        }; //END  if (commentfailz)
        if (commentwinz) {
            console.log("║".blue + logo + " > ".green.bold + "SEND".green.bold + " │ ".blue + time + "@" + parentAuthor + "'s Response Sent on Block #" + headstreamblock);
            if (debugmode == true) {
                console.log(commentwinz);
            };
                countdown();
        }
    });
    } else {
        console.log("║".blue + logo + " W ".yellow.dim + "WAIT".yellow + " │ ".blue + "Waiting on Comment Limiter to F**k Off!");
        setTimeout(function() {
            // Load first op without removing
            console.log("║".blue + logo + " > ".yellow.dim + "SEND".yellow.dim + " │ ".blue + "@" + parentAuthor + "'s Queued Response is Broadcasting");
            steem.broadcast.comment(wif, parentAuthor, parentPermlink, tippy, permlink, title, content, metadata, function (errqc, winqc) {
                if(errqc){  console.log("something fucked up")      };
                if(winqc){
                    console.log("║".blue + logo + " > ".green.bold + "SEND".green.bold + " │ ".blue + "@" + parentAuthor + "'s Response Sent on Block #" + headstreamblock);
                    countdown();
                };
            });
        }, counttime)
        };
};//END replycomment



If anyone can spot where I've gone wrong (besides the obvious self taught hacky as hell code) or has a nodeJS function that does what I'm looking to accomplish they don't mind sharing I'd highly appreciate it! Been scratching my noodles and trial and erroring against this problem for too damn long now. Time to get a hand, get it working and continue forwards!

Looking forward to getting Tippy running and it's source code released to the public before STEEM communities get implemented..! Will be exciting times for sure and will allow me to move onto other projects I've been neglecting over the past while. Thanks for reading and kudos in advance for any advice or debug help offered. <3


Vote @KLYE for Witness
H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now