Hyperstack.on_server? can do much better please

Offen
#345 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
rails, ruby
Bereich
backend

Rechercherichtung

Beginne damit, Hyperstack.on_server? und die im Issue beschriebene Überschreibung des Initializers nachzuverfolgen, und vergleiche dann die erwähnten Modi simple_poller und Action Cable. Erledigt ist die Aufgabe, wenn die Annahme zum Serverstandort durch forward_messages_to_server? sowie durch Konfigurations- oder Verhaltensprüfungen ersetzt wurde, die unnötige Weiterleitungen vermeiden und gleichzeitig erforderliche Broadcasts erhalten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement needs doc

Currently Hyperstack.on_server? returns false if you not on the rails server (i.e. on the console or on in a sidekiq worker).

The system uses this to decide if it needs to forward any broadcasts to the server from, under the assumption that if you are not on the server you do not have access to the broadcast mechanism.

This assumption is pretty weak. The following are known cases where it doesn't matter:

you are using simple_poller (in this case you are going to shove the message into a queue, and wait for the next poll)

you are using action_cable NOT in async mode. (i.e. the connection data is stored in a database, not in the servers memory)

Not tested is pusher, and actually not tested (but I'm sure it would work is action_cable and redis)

Soooo...

This method should be called: forward_messages_to_server?
and should check to see if we have to forward it, by a combination of checking configuration and/or checking actual behavior.

Why should I care?

Because if you are using a lot of outside processes to do stuff, then you are adding unneeded overhead forwarding this stuff to the server.

The current work around is very simple: Just add this line to the hyperstack initializer

def Hyperstack.on_server?; true; end

Vorherrschende Sprache
JavaScript
Sterne
538
Forks
41
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus hyperstack-org/hyperstack

Alle Issues in hyperstack-org/hyperstack

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.