Skip to content

Commit

Permalink
Differing logic between streaming and realtime
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Dec 11, 2012
1 parent 59573b0 commit 392be82
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/sentry/static/sentry/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
var BasePage = Backbone.View.extend({

defaults: {
// can this view stream updates?
stream: false,
// should this view default to streaming updates?
realtime: false
},

Expand Down Expand Up @@ -63,6 +66,7 @@
id: id,
maxItems: 5,
pollUrl: uri,
stream: this.options.stream,
realtime: this.options.realtime,
model: app.Group
});
Expand Down
5 changes: 3 additions & 2 deletions src/sentry/static/sentry/scripts/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@

defaults: {
realtime: false,
stream: false,
pollUrl: null,
pollTime: 1000,
tickTime: 100
Expand Down Expand Up @@ -328,7 +329,7 @@
return;

var item = this.queue.pop();
if (this.options.realtime){
if (this.options.stream){
this.addMember(item);
} else if (this.hasMember(item)) {
this.updateMember(item, {
Expand All @@ -340,7 +341,7 @@
poll: function(){
var data;

if (!this.options.realtime)
if (!this.options.realtime || !this.options.stream)
return window.setTimeout(this.poll, this.options.pollTime);

data = app.utils.getQueryParams();
Expand Down
3 changes: 2 additions & 1 deletion src/sentry/templates/sentry/groups/group_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ <h6>{% trans filter.label %}</h6>
$(function(){
new app.StreamPage({
groups: {{ event_list.paginator.objects|to_json:request|safe }},
realtime: {{ has_realtime|to_json|safe }}
stream: {{ has_realtime|to_json|safe }},
realtime: true
});
});
</script>
Expand Down

0 comments on commit 392be82

Please sign in to comment.