#403 Missing hubs.widget.update message
Closed 8 years ago Opened 8 years ago by shaily.

It is seen in the triage daemon's source hubs.backend.triage.is_widget_update that a message with topic ending with "hubs.widget.update" is expected when a widget is updated.

Where is this message supposed to be emitted from?

It is one of the two triggers for rebuilding a widget's cache by the worker daemon (the other being its should_invalidate method).

Since the cache is successfully rebuilt on widget updates by virtue of how caching is implemented in hubs.widgets.caching.CachedFunction.get_data, it's not necessary to emit this message.


In what other cases could we possibly use this message?

I think we would need Hubs to emit messages in order to fix this TODO in hubs.backend.triage.get_widgets:

def get_widgets():
    # Get a list of all our widgets:
    log.debug("Querying for all widgets.")
    widgets = session.query(hubs.models.Widget).all()
    # Filter out widgets that have been disabled.
    widgets = [w for w in widgets if w.enabled]
    # Randomize so that all the triage daemons work on widgets in different
    # orders.  This should hopefully prevent cache thrashing.
    log.debug("Randomizing list of all widgets.")
    random.shuffle(widgets)
    # TODO: cache the widgets list until a widget is added or deleted?
    return widgets

Metadata Update from @shaily:
- Issue status updated to: Closed (was: Open)

8 years ago

Log in to comment on this ticket.

Metadata