Question about widget refresh rate & dashboard loops (polling method)


#1

Hello,

Last week I had to implement a cache on my queries to appannie API because we were regularly bumping to the limit of 1000 queries a day.

This got me wondering how does geckoboard handle dashboard loops. An example will probably explain it best:
Note: I’m using poll, not push.

I have 5 dashboards.
Each dashboard has about 8 widgets which data comes from appannie
Each widget is configured to refresh every 1h

If I display just 1 static dashboard, I expect to have 8 queries an hour.
However, I have a loop which opens each dashboard every 20s

So my question is: does this loop make new queries every 20s, or do I have 5 * 8 = 40 queries an hour as for the single static dashboard ?

Thanks


#2

Heya Kevin,

Great question! You’ll see an initial request to your widgets/endpoints when you first open the Sharing Loop, but after that you’ll only see requests every hour (or however you configure the widget refresh rate).

Just to verify this, I made a Sharing Loop with two dashboards each with one widget. The widgets are set to refresh every minute and the Loop rotates every 10 seconds. Here’s a quick screencast with a terminal log showing that even though the dashboard loop is rotating, the widget endpoints are still only being requested once per minute: https://www.dropbox.com/s/m2oq69s1i5rx7g3/polling.mp4?dl=0

I am using a simple express server with morgan for logging – in case someone finds this helpful, here’s the code (or link to Gist):

'use strict';

const express = require('express'),
      app = express(),
      morgan = require('morgan');

let R = () => Math.floor(Math.random() * 100);

app.use(morgan('common'));

app.get('/:widget', (req, res) => {
  // Respond with  a https://developer.geckoboard.com/#number-and-secondary-stat widget
  res.json({ item: [ { value: R() } ] });
});

app.listen(3000, () => {
  console.log('Server started on localhost:3000');
});

#3

Thanks for the detailed answer. That’s exactly what I thought, but I just wanted to make sure :wink:
Indeed I could have found by myself, I just don’t have much time to login to the server and look for the logs nowadays.


#4

I’m glad it was helpful – It’s much easier for me too to trust something after a visual confirmation :wink:


#5

Thanks for answer Finally I found solution for my scratchmania. Jason good luck you!