ameliabradley / wikiedit-monitor

Wikipedia monitor
3 stars 2 forks source link

Moved to event-based architecture; formatted & filtered console output #24

Closed Barbarrosa closed 8 years ago

Barbarrosa commented 8 years ago

@leebradley This merge request includes some of the dashboard changes, but it mostly switches to an event-based architecture so that we can trigger whatever we want based on responses we get from Wikipedia, socket data, errors, etc. without excessive code coupling.

I also added the "test" script so that "npm test" works.

The console output is now restricted to just the "interesting" records, e.g. rejected revision requests from Wikipedia and deleted articles instead of every edit. Here's an example:

------------------------------------------------------------------------------------------
| Saving 2 edits.                                                                        |
------------------------------------------------------------------------------------------
***** Requesting 7 diffs from Wikipedia
***** INSERTED (socketdata:12,wikiedits:2,errorlog:0) records in 23ms
***** Wikipedia returned in 1.22s
------------------------------------------------------------------------------------------
| Saving 7 edits.                                                                        |
------------------------------------------------------------------------------------------
***** Requesting 23 diffs from Wikipedia
***** INSERTED (socketdata:35,wikiedits:7,errorlog:0) records in 29ms
***** Wikipedia returned in 0.41s
------------------------------------------------------------------------------------------
| Saving 17 edits.                                                                       |
|----------------------------------------------------------------------------------------|
| Rejected [not_cached]                                                                  |
|----------------------------------------------------------------------------------------|
| ClueBot NG           | Adam Gontier                   | Reverting possible vandalism b |
| David J Johnson      | Vicky McClure                  | /* Awards and nomunations */ H |
| Jaguar               | Talk:Origins of names of citie | /* top */cleanup using [[Proje |
| Jaguar               | Talk:Ongniud Banner            | /* top */cleanup using [[Proje |
| Jaguar               | Talk:Ordos Loop                | cleanup using [[Project:AWB|AW |
| 124.83.17.74         | M. Visvesvaraya                |                                |
------------------------------------------------------------------------------------------
***** Requesting 19 diffs from Wikipedia
***** INSERTED (socketdata:15,wikiedits:17,errorlog:0) records in 28ms
***** Wikipedia returned in 0.5s
------------------------------------------------------------------------------------------
| Saving 18 edits.                                                                       |
|----------------------------------------------------------------------------------------|
| Rejected [not_cached]                                                                  |
|----------------------------------------------------------------------------------------|
| Necrothesp           | Wikipedia:Articles for deletio | /* Randolph Southern Junior-Se |
------------------------------------------------------------------------------------------
Barbarrosa commented 8 years ago

I guess I just moved your existing test script into the block I had created :-P

Anyways, I avoided adding types to the events for now b/c it's a lot of overhead to take on in the short term. I'm considering adding them later to provide better guarantees of what properties will be available on various events.