Commit Graph

71 Commits

Author SHA1 Message Date
Matt (IPv4) Cowley
2a6c363a8a feat(Shard): shard-specific broadcastEval/fetchClientValues + shard Id util (#4991) 2020-11-22 13:35:18 +01:00
Matt (IPv4) Cowley
adf2e872f8 fix(Shard): don't pass event arguments to exit handler (#4957) 2020-11-01 12:29:29 +01:00
Sugden
af670fc718 refactor: improve the accuracy of docs/improve docs (#4845)
Co-authored-by: Noel <icrawltogo@gmail.com>
2020-10-17 15:53:02 +02:00
Matt (IPv4) Cowley
77c0788b2c fix(Shard): avoid caching null child in eval/fetchClientValue (#4823) 2020-09-25 23:43:32 +02:00
Noel
5249cf33e5 revert(Shard): "fix missing child_process silent option of Shard to allow listening to output" (#4707)
This reverts commit 58d1589a55.
2020-08-15 12:50:05 +02:00
Jared Gesser
58d1589a55 fix missing child_process silent option of Shard to allow listening to output (#4308) 2020-08-11 23:01:19 +02:00
Spooder
b5a7e5cdf0 docs(sharding): ShardingManager#createShard doesn't spawn the s… (#3875)
* Fixed createShard() to show an example!

* docs(ShardingManager): clarify createdShard docs

* docs(Shard): clarify manager parameter

* docs(ShardingManager): use an info tag for createShard's param

Co-Authored-By: Sugden <28943913+NotSugden@users.noreply.github.com>

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com>
2020-03-07 06:00:11 +01:00
SpaceEEC
31ee0d84d5 docs(shard): add .cache to GuildManager in fetchClientValue exa… (#3857) 2020-02-29 15:10:47 +01:00
Crawl
c065156a88 chore: consistency/prettier (#3852)
* chore: consistency/prettier

* chore: rebase

* chore: rebase

* chore: include typings

* fix: include typings file in prettier lint-staged
2020-02-29 14:35:57 +01:00
Sugden
f95df6f7d7 fix(Shard): cleanup after settling spawn promise (#3799)
* clear sharding ready timeout

* fix oops

* update typings

* commited to the wrong branch

* fix(Shard): cleanup after settling the spawn promise

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
2020-02-29 14:18:57 +01:00
Crawl
3a0470b45c chore(deps): update deps and fix lint (#3833) 2020-02-24 23:14:31 +01:00
Vlad Frangu
5519d6fbaa src: sharding cleanup and checkReady rewrite (#3393)
* src: Step 1 of who knows how many

* src: Remove accidentally committed test file

* src: Remove useless added property in package.json

* docs: Trailing spaces, come back >.>

* src: Buhbye uws, we will miss you..not!

* src: Move 'auto' shard selection from totalShardCount to shards

* src: tweak

* src: Filter out floats from shard IDs
You want half of a shard or what?

* src: Misc cleanup and bugfix for GUILD_BAN_ADD

* src: Rewrite checkReady

* src: Misse this while merging master into my branch

* typings: Bring these up to date

* typings: Forgot allReady event

* src: Don't checkReady if the shard isn't waiting for guilds

* src: Fix a possible bug for when the ws dies and the session becomes -1

* src: Hopefully fix last edge case that could case a shard to infinitely boot loop

* src: Rename totalShardCount to shardCount

* src: Small bugfix

* src: Correct error message for shardCount being imvalid

Co-Authored-By: bdistin <bdistin@gmail.com>

* src: Small tweaks

* src: If this doesn't fix the issues I'm gonna throw a brick at my PC

* src: I swear, STOP BREAKING

* src: *groans at a certain snake*

* src: Use undefined instead of null on destroy in close event

Setting it to null sets the close code to null, which causes a WebSocket error to be thrown. The error is thrown from WebSocket, although there is no connection alive. Fun times!

* src: @SpaceEEC's requested changes

* src: Remove zucc from discord.js

Discord is removing support for it, sooo... Bye bye

* src: Missed this

* src: Apply @kyranet's suggestions

Co-Authored-By: Antonio Román <kyradiscord@gmail.com>

* src: @kyranet's suggestions

* src: Remove pako, update debug messages
- Pako is officially gone from both enviroments
  Install zlib-sync on node.js if you want it
- Improve a few debug messages some more
- Discover that internal sharding works in browsers but please don't do that
2019-12-15 20:45:27 +01:00
Kitten King
d8516efa36 docs: fix typos (#3404) 2019-07-25 17:18:23 +02:00
Antonio Román
01c708bc75 feat(Sharding): change waitForReady to spawnTimeout (#3080)
This means that you'll not only be able to choose between having a timeout or not, but also to set the amount of milliseconds as you wish.
2019-04-21 13:34:09 +02:00
Gus Caplan
42505b78c1 chore: add strict mode (#2974) 2018-12-03 15:19:10 -06:00
Isabella
f3cad81f53 feat: Internal sharding (#2902)
* internal sharding

* ready event

* the square deal

* the new deal

* the second new deal

* add actual documentation

* the new freedom

* the great society

* federal intervention

* some of requested changes

* i ran out of things to call these

* destroy this

* fix: Client#uptime went missing

* fix(Client): destroy the client on login failure

This may happen duo invalid sharding config / invalid token / user requested destroy

* fix(Client): reject login promise when the client is destroyed before ready

* fix(WebSocketManager): remove redundancy in destroy method (#2491)

* typo(ErrorMessages): duo -> duo to

* typo(ErrorMessages): duo -> due

* fix: docs and options

* docs(WebSocketManager): WebSockethard -> WebSocketShard (#2502)

* fix(ClientUser): lazily load to account for extended user structure (#2501)

* docs(WebSocketShard): document class to make it visible in documentation (#2504)

* fix: WebSocketShard#reconnect

* fix: presenceUpdate & userUpdate
* presenceUpdate wasn't really being handled at all
* userUpdate handled incorrectly because as of v7 in the Discord API, it comes inside presenceUpdate

* re-add raw event

* member is now part of message create payload

* feat: Add functionality to support multiple servers with different shards (#2395)

* Added functionallity to spawn multiple sharding managers due to adding start and end shards

* Small fixes and limiting shard amount to max recommended

* Forgot a check in spawn()

* Fixed indentation

* Removed optiosn object documentation for totalShards

* More fixes and a check that the startShard + amount doesnt go over the recommended shard amount

* fix getting max recommended

* Removed async from constructor (my fault)

* Changed start and end shard to a shardList or "auto" + fixed some brainfarts with isNaN

* Changed the loop and totalShard count calculation

* shards are actually 0 based

* Fixed a problem with the gateway and handled some range errors and type errors

* Changed Number.isNan to isNaN and changed a few Integer checks to use Number.isInteger

* Added check if shardList contains smth greater than totalShards; made spawn use totalShards again; shardList will be ignored and rebuild if totalShards is 'auto'; fixed docs

* ShardingManager#spawn now uses a for..of loop; fixed the if statement inside the new for..of loop to still work as intended; made the totalShards be set to a new amount if smth manual is put into ShardingManager#spawn just like before; Fixed some spelling

* internal sharding

* ready event

* the square deal

* the new deal

* the second new deal

* add actual documentation

* the new freedom

* the great society

* federal intervention

* some of requested changes

* i ran out of things to call these

* destroy this

* fix: Client#uptime went missing

* fix(Client): destroy the client on login failure

This may happen duo invalid sharding config / invalid token / user requested destroy

* fix(Client): reject login promise when the client is destroyed before ready

* fix(WebSocketManager): remove redundancy in destroy method (#2491)

* typo(ErrorMessages): duo -> duo to

* typo(ErrorMessages): duo -> due

* fix: docs and options

* docs(WebSocketManager): WebSockethard -> WebSocketShard (#2502)

* fix(ClientUser): lazily load to account for extended user structure (#2501)

* docs(WebSocketShard): document class to make it visible in documentation (#2504)

* fix: WebSocketShard#reconnect

* fix: presenceUpdate & userUpdate
* presenceUpdate wasn't really being handled at all
* userUpdate handled incorrectly because as of v7 in the Discord API, it comes inside presenceUpdate

* Internal Sharding adaptation

Adapted to internal sharding
Fixed a bug where non ready invalidated sessions wouldnt respawn

* Fixed shardCount not retrieving

* Fixing style

removed unnecessary parenthesis

* Fixing and rebasing

lets hope i didnt dun hecklered it

* Fixing my own retardation

* Thanks git rebase

* fix: assigning member in message create payload

* fix: resumes

* fix: IS wont give up reconnecting now

* docs: add missing docs mostly

* fix: found lost methods

* fix: WebSocketManager#broadcast check if shard exists

* fix: ShardClientUtil#id returning undefined

* feat: handle new session rate limits (#2796)

* feat: handle new session rate limits

* i have no idea what i was doing last night

* fix if statement weirdness

* fix: re-add presence parsing from ClientOptions (#2893)

* resolve conflicts

* typings: missing typings

* re-add missing linter rule

* fix: replacing ClientUser wrongly

* address unecessary performance waste

* docs: missing disconnect event

* fix(typings): Fix 2 issues with typings (#2909)

* (Typings) Update typings to reflect current ClientOptions

* fix(Typings) fixes a bug with Websockets and DOM Types

* fix travis

* feat: allow setting presence per shard

* add WebSocketManager#shardX events

* adjust typings, docs and performance issues

* readjust shard events, now provide shardId parameter instead

* fix: ready event should check shardCount, not actualShardCount

* fix: re-add replayed parameter of Client#resume

* fix(Sharding): fixes several things in Internal Sharding (#2914)

* fix(Sharding) fixes several things in Internal Sharding

* add default value for shards property

* better implement checking for shards array

* fix travis & some casing

* split shard count into 2 words

* update to latest Internal Sharding, fix requested changes

* make sure totalShardCount is a number

* fix comment

* fix small typo

* dynamically set totalShardCount if either shards or shardCount is provided

* consistency: rename shardID to shardId

* remove Client#shardIds

* fix: typo in GuildIntegrationsUpdate handler

* fix: incorrect packet data being passed in some events (#2919)

* fix: edgecase of ShardingManager and totalShardCount (#2918)

* fix: Client#userUpdate being passed wrong parameter
and fix a potential edgecase of returning null in ClientUser#edit from this event

* fix consistency and typings issues

* consistency: shardId instances renamed to shardID

* typings: fix typings regarding WebSocket

* style(.eslintrc): remove additional whitespace

* fix(Client): remove ondisconnect handler on timeout

* docs(BaseClient): fix typo of Immediate

* nitpick: typings, private fields and methods

* typo: improve grammar a bit

* fix: error assigning client in WebSocketManager

* typo: actually spell milliseconds properly
2018-11-03 13:21:23 -05:00
Schuyler Cebulskie
ab3a439198 Add worker-based sharding to the ShardingManager (#2908)
* Add worker-based sharding mode to ShardingManager

* Fix ClientShardUtil mode

* Fix worker not being cleared on shard death

* Update docs and typings

* Clean up Client sharding logic a bit

* Add info about requirements for worker mode
2018-10-29 15:02:36 -04:00
SpaceEEC
73b9b0e62b fix(Shard): use DISCORD_TOKEN instead of CLIENT_TOKEN, see #2843 2018-10-13 15:20:56 +02:00
Lewdcario
93f8c8547b fix(Shard): allow node to default to process.execArgv 2018-06-29 15:13:01 -05:00
Lewdcario
6b3bfdd7de fix(Shard): fix default args 2018-06-25 16:10:50 -05:00
Isabella
bfbb723f42 feat(ShardingManager): add execArgv option (#2585) 2018-06-23 16:09:03 -05:00
Schuyler Cebulskie
d97af9d2e0 Improveder 2018-06-17 00:51:32 -04:00
Schuyler Cebulskie
f91747a764 Improve Shard#kill description 2018-06-17 00:50:38 -04:00
Lewdcario
512af54e5d fix(Shard): erroneously returning false
The node documentation fails to correctly document when the backlog of unsent messages exceeds a certain threshhold the function will return false. This does not mean it will refuse to send- simply that it will take time. Issue in point: https://github.com/nodejs/node/issues/7657#issuecomment-240581726
2018-06-04 18:01:10 -05:00
Will Nelson
fc81924724 feat: Shard#kill method (#2454)
* add shard#kill method

* docs consistency
2018-05-27 03:26:18 -05:00
Lewdcario
745669a7c9 docs: consistency 2018-04-29 13:28:12 -05:00
Schuyler Cebulskie
952a7123f3 Add missing word in Shard#respawn docblock 2018-04-09 14:35:49 -04:00
Gus Caplan
8aafcd6cde allow passing a function to shard eval (#2193) 2018-01-12 14:05:27 +01:00
Schuyler Cebulskie
e792757e32 Only create ShardClientUtil when spawned by ShardingManager 2018-01-08 22:13:46 -05:00
Schuyler Cebulskie
c6244ee6e1 Fix shards not respawning on exit 2017-11-20 22:37:35 -05:00
Schuyler Cebulskie
527c729aca Possibly fix weird behaviour 2017-11-20 22:29:46 -05:00
Schuyler Cebulskie
c447abad60 Clear evals and fetches on process death 2017-11-20 22:26:14 -05:00
Schuyler Cebulskie
b5459a96fa Move ShardingManager#message event to Shard#message 2017-11-20 22:20:32 -05:00
Schuyler Cebulskie
26b28813a8 Use a custom promisified setTimeout 2017-11-19 13:47:04 -05:00
Schuyler Cebulskie
acf82f32c3 Mark Shard#_exitListener as private 2017-11-19 02:31:06 -05:00
Schuyler Cebulskie
1338e9bd8e Update sharding docs some more 2017-11-19 02:30:20 -05:00
Schuyler Cebulskie
975da5f1a5 Rewrite sharding class descriptions and link Client 2017-11-19 02:21:29 -05:00
Schuyler Cebulskie
f777c19fbf Fix naming conflict with ShardingManager#respawn 2017-11-19 02:03:44 -05:00
Schuyler Cebulskie
2a332d8d15 Add ShardClientUtil#respawnAll 2017-11-19 01:54:10 -05:00
Schuyler Cebulskie
a414e4884f Overhaul sharding 2017-11-19 01:28:46 -05:00
SpaceEEC
6fa4fc532c fix(Shard): extend EventEmitter to be able to emit events (#2112) 2017-11-17 02:49:57 -05:00
Schuyler Cebulskie
196cf7652e Add Shard#ready property and related events 2017-11-16 22:49:38 -05:00
iCrawl
2aa2f73c74 Docs cleanup 2017-08-17 20:04:01 +02:00
Gus Caplan
63e54982f4 Errors Standardization (#1246)
* errors and stuff

* more errors

* all the errors

* fix build
2017-06-25 18:48:05 +01:00
Crawl
ac92d2cecc Improve docs a bit 2017-04-30 04:30:44 +02:00
Schuyler Cebulskie
7232531eb1 Move all util methods into class
Remove TransformMessageOptions altogether
2017-02-15 22:25:18 -05:00
bdistin
4d2153c7c6 Document ShardingManager#message (#1024)
* Document ShardingManager#message

* Update Shard.js
2016-12-27 22:44:17 -05:00
Schuyler Cebulskie
90304aa7d6 Fix loads of JSDoc type issues 2016-11-12 20:52:37 -05:00
Schuyler Cebulskie
8306d50bd8 Clean up a bunch of promise stuff 2016-10-30 12:47:17 -04:00
Schuyler Cebulskie
ecee07655f Simplify Shard.env 2016-10-26 15:31:05 -04:00