1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-01 04:24:19 +00:00
Commit graph

129 commits

Author SHA1 Message Date
diamondburned 525d0bb3f6 API: Move ExecuteWebhookData, add package sendpart for uploads
This commit moved ExecuteWebhookData from package api to package webhook
inside package api. This change required splitting the multipart
abstractions away from package api, so they are now inside package
sendpart in utils.

This commit will break code that uploads anything, as the type name is
now sendpart.File from api.SendMessageFile. The behavior should be the
same as before.
2020-12-16 13:11:11 -08:00
diamondburned d65807ce15 API: Potential rate limit fix for reactions 2020-12-11 17:58:52 -08:00
diamondburned 5a76b21ecf wsutil: Fixed irregular close 1000 error 2020-11-30 21:49:55 -08:00
Maximilian von Lindern 0a8b24339b
API: Added timeout if deadline is after rate limit (#173)
* Rate: don't sleep if sleep exceeds context deadline

* Httputil: add Client.Timeout

* Bot: set default API timeout to 5 minutes

* Rate: reduce calls to time.Now in Acquire

* API: Optimize to use deadline instead of recalculating

Co-authored-by: diamondburned <datutbrus@gmail.com>
2020-11-25 12:08:42 -08:00
mavolin b9d7ba4476 Option: fix nullable types getting serialized to nil on JSON null 2020-11-22 09:33:33 -08:00
diamondburned 1aaa2cbfe2 httputil: Removed debug logs 2020-11-14 15:36:18 -08:00
diamondburned 6cbe95d2b3 State: Fixed erroneous context setting and races in Ready 2020-11-14 15:30:18 -08:00
diamondburned f6e270ae9c json: Fixed a race condition with erroneous JSON streams 2020-11-14 14:18:50 -08:00
diamondburned a3aa490024 wsutil: Reset SendLimiter after Dial 2020-11-01 10:12:35 -08:00
diamondburned bd1696ef65 wsutil: Added super verbose logs 2020-11-01 10:12:31 -08:00
diamondburned a46d3c2c8d wsutil: Added possibly missing Reset cases and more debug logs 2020-10-31 15:54:51 -07:00
diamondburned 63310fdc95 wsutil: Added graceful close checking 2020-10-30 13:54:35 -07:00
diamondburned 16c1658163 {,Voice}Gateway: Refactored Closing
This commit refactors both wsutil, the normal Gateway and the Voice
Gateway to have better closing behavior, which should assume less and
cover edge cases completely.
2020-10-30 11:02:37 -07:00
diamondburned 8d21c5f43f Merge wsutil bug fixes and changes onto v2 2020-10-29 11:25:09 -07:00
diamondburned 7668fe940c wsutil: Websocket wrapper thread safety for simpler Conn impl
This commit removes the thread safety requirement that Conn
implementations must satisfy. It moves the mutex guards as well as the
multiple close wrapper over to the Websocket wrapper instead.
2020-10-29 11:24:45 -07:00
diamondburned 9b4b707070 Handler: Use a free list over a linked list 2020-10-28 23:55:39 -07:00
diamondburned ef48d686cd Handler: Changed to a linked list instead of a slice-backed map
This change should slightly improve the performance of the handler
container.

A rough benchmark was written and tested; the source code is at
https://gist.github.com/diamondburned/c369d13efda5c702a0e59874deee64bd.
2020-10-28 22:37:38 -07:00
diamondburned 33e7abd4db Merge wsutil fix from v1 into v2 2020-10-28 19:03:10 -07:00
diamondburned 160a4e6606 wsutil: Fixed data races involving getters 2020-10-28 19:00:59 -07:00
diamondburned 75df94d9f4 *: Migrated Go Modules to v2 2020-10-28 15:39:59 -07:00
diamondburned 16a408bf30 wsutil: Refactored and decoupled structures for better thread safety 2020-10-28 10:19:22 -07:00
diamondburned 6c332ac145 {Voice,}Gateway: Fixed various race conditions
This commit fixes race conditions in both package voice, package
voicegateway and package gateway.

Originally, several race conditions exist when both the user's and the
pacemaker's goroutines both want to do several things to the websocket
connection. For example, the user's goroutine could be writing, and the
pacemaker's goroutine could trigger a reconnection. This is racey.

This issue is partially fixed by removing the pacer loop from package
heart and combining the ticker into the event (pacemaker) loop itself.

Technically, a race condition could still be triggered with care, but
the API itself never guaranteed any of those. As events are handled
using an internal loop into a channel, a race condition will not be
triggered just by handling events and writing to the websocket.
2020-10-22 10:47:27 -07:00
diamondburned 91ee92e9d5 Gateway: Fixed a race condition on ReconnectOP 2020-10-21 22:42:16 -07:00
diamondburned 6b4e26e839 wsutil: Improved internal code 2020-08-20 14:15:52 -07:00
diamondburned de61fd912d wsutil: Made PacemakerLoop valid as zero-value 2020-08-19 21:30:57 -07:00
diamondburned 94cca0adca httputil: Fixed unlock of unlocked mutex bug 2020-08-04 14:09:43 -07:00
Maximilian von Lindern 1585797b52 *: Linting and typo fixes (#134)
* Linting and typo fixes

* Linting and typo fixes

* revert comma fix
2020-07-29 16:58:33 -07:00
Maximilian von Lindern 32789bb6e2 *: Separate utils and internal (#129)
* Utils: move package utils/heart to internal/heart

* Utils: move package utils/moreatomic to internal/moreatomic

* Utils: move package utils/zlib to internal/zlib
2020-07-29 16:58:33 -07:00
mavolin ba4b224168 handler: move package from /handler to /utils/handler 2020-07-29 16:58:33 -07:00
Tadeo Kondrak d290b0d01c *: Add typed Snowflake IDs (#122)
This PR closes #120.
2020-07-29 16:58:33 -07:00
diamondburned 5b37b2ab0d Gateway: Allow for longer timeouts 2020-07-14 18:47:52 -07:00
diamondburned c1885067d7 Gateway: Allow for more lenient gateway bursts 2020-07-14 18:47:15 -07:00
diamondburned f33b4ff7d8 wsutil: API changed to support contexts 2020-07-11 12:49:28 -07:00
Maximilian von Lindern de3d0e2160
Gateway: Split GuildCreateEvent (#116)
* Session: fix event handler loop not getting properly closed

* Implement #113

* Session: move guild events to state

* Session: close hStop
2020-06-06 13:47:15 -07:00
mavolin a76c9031c1 API: fix #91 2020-05-22 10:52:30 -07:00
mavolin 41ce1f389e
make all error messages lowercase 2020-05-16 23:14:49 +02:00
diamondburned (Forefront) ae793848aa Utils: Exposed NullableTData structs 2020-05-12 17:09:43 -07:00
Maximilian von Lindern ae14c8fb73
Merge branch 'master' into 44-data-structs 2020-05-12 03:57:35 +02:00
mavolin 04a80d33e8
API: add docs, use option types 2020-05-12 03:44:13 +02:00
diamondburned (Forefront) d82aa60fdc Utils: Added extra wsutil logging 2020-05-11 16:57:40 -07:00
mavolin dafda812dd
Utils: allow inheritance for custom types 2020-05-11 23:32:48 +02:00
mavolin bc188140f0
Utils: add NullableX types in option 2020-05-11 23:32:22 +02:00
mavolin b3bfc29732
Utils: move Enum to package enum 2020-05-11 22:43:52 +02:00
mavolin 4a30938db0
Utils: use package names for package doc file 2020-05-11 13:54:45 +02:00
mavolin b17c32187e
API: implement option and nullable types. 2020-05-11 05:24:59 +02:00
mavolin b30a1fb7d2
Utils: add custom option types 2020-05-11 05:24:12 +02:00
mavolin a29a521c5a
Utils: add nullable package 2020-05-11 04:30:34 +02:00
mavolin e522aaef9b
Discord: add Enum type 2020-05-11 03:24:11 +02:00
mavolin 795182df16
Discord: docs: add 2020-05-11 03:14:46 +02:00
mavolin c642c8f306
Discord: refactor: move json.OptionT to dedicated json/option package 2020-05-11 03:14:30 +02:00
diamondburned (Forefront) a298160529 API: Fixed schema error 2020-05-09 16:25:24 -07:00
diamondburned (Forefront) 0f38294048 API: Added GuildWithCount 2020-05-09 14:59:39 -07:00
diamondburned (Forefront) 3a43e413d8 Utils: Deprecated client-scoped JSON driver 2020-05-07 20:43:46 -07:00
diamondburned (Forefront) 52ca6638f5 Discord: Fixed incorrect Audit Log structures 2020-05-07 20:01:44 -07:00
diamondburned (Forefront) 56d189be3d Discord/API: Added Audit Log 2020-05-07 17:09:45 -07:00
diamondburned (Forefront) 9e33386546 Merge branch 'master' of github.com:diamondburned/arikawa 2020-05-07 12:33:06 -07:00
diamondburned (Forefront) 619558ecab API: Several breaking updates to conform with current documentation 2020-05-07 12:32:56 -07:00
mavolin e7c1c891fb
Utils: Create Constant for HTTP status code 429 2020-05-07 18:49:07 +02:00
mavolin c7a392f836
Utils: Fix #25 2020-05-07 18:36:15 +02:00
diamondburned (Forefront) 73ba62605b Gateway: Fixed EOF not reconnecting bug 2020-05-06 16:06:06 -07:00
diamondburned (Forefront) f22d6eaa9f Utils/API: Replaced semaphore-mutex API 2020-05-06 00:40:31 -07:00
diamondburned (Forefront) e07784a03a Utils: Swapped go-csync with /x/sync/semaphore 2020-05-06 00:32:21 -07:00
diamondburned (Forefront) 450a112878 Utils: Removed go-deadlock dependency meant to be used for debugging 2020-05-06 00:20:25 -07:00
diamondburned (Forefront) cb525ca5c0 Utils: Fixed a nil dereference bug 2020-05-05 15:36:14 -07:00
diamondburned (Forefront) 0c24ac627b Utils: Fixed bug where retries aren't applied options again, causing rate limits 2020-05-05 15:32:28 -07:00
diamondburned (Forefront) a0bccd9c35 API: Added WithContext API, closes #15 2020-05-03 14:02:03 -07:00
diamondburned (Forefront) 51e88a47b2 Gateway/Voice: Improved the event loop, fixed race conditions 2020-04-25 00:13:07 -07:00
diamondburned (Forefront) 3005c7b44a Voice: Separated UDP and WS into packages, added io.Writer API 2020-04-24 19:36:33 -07:00
diamondburned (Forefront) 54ac0a6951 Gateway: Migrated to wsutil.PacemakerLoop 2020-04-24 15:30:15 -07:00
diamondburned (Forefront) 443ec791af Heart: Moved PacemakerLoop to wsutil, changed Gateway abstractions to generic ones 2020-04-24 15:09:05 -07:00
diamondburned (Forefront) 2f076c041e Gateway: Migrated functions and variables to other packages, added JSON default codecs 2020-04-23 23:34:08 -07:00
diamondburned (Forefront) c0c17085ba Heart: Migrated Voice to PacemakerLoop 2020-04-23 20:52:18 -07:00
diamondburned (Forefront) 2afe683b7d Utils: Added HTTP drivers 2020-04-19 14:53:53 -07:00
diamondburned (Forefront) b9384042bb Gateway: Added GatewayBot 2020-04-19 09:17:04 -07:00
diamondburned (Forefront) 3d47bada07 Gateway: Fixed the double Close and Gateway ReconnectOP bugs 2020-04-11 12:34:40 -07:00
diamondburned (Forefront) 06136b7d5f Websocket: Replaced Conn's mutices with channels 2020-04-10 20:03:52 -07:00
diamondburned (Forefront) 86d32bdbe9 Utils: Removed redundant stdlib errors import 2020-04-09 16:19:52 -07:00
diamondburned (Forefront) cc530ce7a2 Bot: Allow func(T), added more documentation, minor fixes 2020-04-09 13:49:12 -07:00
diamondburned (Forefront) be12849668 Changed internal/ to utils/, allowing external imports 2020-04-08 19:28:40 -07:00