aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeLines
...
| * | | | | | | Set exception on futureGravatar Numerlor2021-01-10-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without the exception set, to the user the bot would fail silently if an exception was handled here
| * | | | | | | Refresh inventories when the redis cache is clearedGravatar Numerlor2021-01-10-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the futures are cleaned up and Markdown only exists in the cache after a short time, items that were requested previously and had the cache cleared would be missing from the CachedParser
| * | | | | | | Handle equal DocItems in the queueGravatar Numerlor2021-01-10-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This could be handled by using sets to hold the items in _page_symbols, but ultimately the check has a much smaller cost than having thousands of sets for the urls. Because we create futures for every item that ends up in the queue we can also skip the .get is None check and instead fetch the future directly from the dict
| * | | | | | | Stop scheduled and long running tasks on cog unloadGravatar Numerlor2021-01-10-0/+6
| | | | | | | |
| * | | | | | | Periodically clear unnecessary futures from the _item_futures dictGravatar Numerlor2021-01-10-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code has no way of reaching futures through new requests after their result has been set as that also includes setting its value in redis.
| * | | | | | | Do not add package name to the front of the symbol if it's already thereGravatar Numerlor2021-01-09-2/+11
| | | | | | | |
| * | | | | | | Do not ignore symbols with slashes.Gravatar Numerlor2021-01-09-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases these are actual symbols that we can look up
| * | | | | | | Ensure no symbols get overwritten while generating symbol mappingsGravatar Numerlor2021-01-09-19/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code handling this was moved to a function to achieve this cleanly. Includes fixes for bugs where incorrect package was added to the symbol name in the second branch and an incorrect symbol being added in the third branch Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | Do not attempt to set cache values for symbols that were not foundGravatar Numerlor2021-01-09-1/+2
| | | | | | | |
| * | | | | | | Remove redundant variableGravatar Numerlor2021-01-09-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | Add comments to truncation handling codeGravatar Numerlor2021-01-09-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | Use update_wrapper instead of wrapsGravatar Numerlor2021-01-09-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're not using it as a decorator so using wraps only complicates the call syntax
| * | | | | | | Return the fetched inventory in the Inventory converterGravatar Numerlor2021-01-09-46/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of fetching it again in the cog, the converter now returns the inventory for later use. The set command now no longer attempts to reschedule the inventory, and a bug that caused the inventory rescheduling to do nothing in `update_single` was fixed after moving it to its own method
| * | | | | | | Wait for the inventory to be refreshed before attempting any fetchingGravatar Numerlor2021-01-09-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the bot returned an error if a symbol was not found while inventories were refreshing, but we can just wait for the to finish refreshing and then the symbol may be filled in. A logging call to notify of the refresh being done was also added.
| * | | | | | | Create futures for all items in the queueGravatar Numerlor2021-01-09-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Creating futures for everything and then awaiting at the end takes care of all the potential race conditions that may pop up from items that are parsed and sent to redis while the get_markdown method is in the middle of fetching a page. In case it happens with the implementation we'll just need to move the item to the front and the future will get a result set soon afterwards.
| * | | | | | | Clear up docstring so it doesn't rely on private attributeGravatar Numerlor2021-01-09-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | Revert "Clear up docstring so it doesn't rely on private attribute"Gravatar Numerlor2021-01-09-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit ad90978f
| * | | | | | | Run html parsing in an executorGravatar Numerlor2021-01-09-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parsing may take up to a few hundred ms depending on the amount of work it has to do
| * | | | | | | Simplify the implementation of the custom strainerGravatar Numerlor2021-01-09-15/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The strainer now forces the text attribute to be None, simplifying the check on strings and falls back to the superclass' method on non string elements
| * | | | | | | Strip whitespace from symbol Markdown before returning itGravatar Numerlor2021-01-09-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The html we parse frequently ends up with trailing and sometimes leading newlines which get stripped out by discord anyway, we have no reason to keep those around when sending the Markdown over to redis
| * | | | | | | Use cancel_all instead of manually calling cancel repeatedlyGravatar Numerlor2021-01-09-2/+1
| | | | | | | |
| * | | | | | | Use send_denial util instead of creating embed manuallyGravatar Numerlor2021-01-09-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The symbol is also no longer sent back to the user, as it is not necessary and we can skip the cleanup on it
| * | | | | | | Return the sent messageGravatar Numerlor2021-01-09-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the caller to work with the message further
| * | | | | | | Move copyright outside of license textGravatar Numerlor2021-01-09-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | Use string addition instead of joinGravatar Numerlor2021-01-09-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With only two strings, the addition is a bit clearer than constructing and joining a tuple Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | Change param styling to be consistent with the repoGravatar Numerlor2021-01-09-5/+6
| | | | | | | |
| * | | | | | | Call command method directlyGravatar Numerlor2020-12-15-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | Make reschedule delays a module constantGravatar Numerlor2020-12-15-3/+10
| | | | | | | |
| * | | | | | | Reuse form body to construct log messageGravatar Numerlor2020-12-15-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | Clear up grammarGravatar Numerlor2020-12-15-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | Simplify flowGravatar Numerlor2020-12-15-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The else is a bit clearer than the early return
| * | | | | | | Lock inventory refreshesGravatar Numerlor2020-12-15-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All commands that refresh the inventories in some way are now locked to prevent various race conditions that may have occurred in the unlikely scenario that they got triggered together, the fetching part of the get command now also has to wait for the running inventory refresh to finish before proceeding to fetch and parse the html
| * | | | | | | Create function for merging function and decorator wrapper globalsGravatar Numerlor2020-12-15-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | discord.py uses the globals of functions to resolve forward refs in commands, previously decorators applied before commands broke the bot with forwardrefs to names that weren't in the namespace of the module where they were defined, the new function takes care of merging the globals in a new function to mitigate this issue. closes: #1323
| * | | | | | | Provide feedback to user when no cache to clear was foundGravatar Numerlor2020-12-15-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While technically correct, always sending success could be misleading in case of a typo on the package
| * | | | | | | Move parse_queue cleanup into finally blockGravatar Numerlor2020-12-15-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The finally will make sure we reset the task and log it no matter what happens, additionally the clearing of the variable is now only done in one place as the finally also executes when the coro is cancelled
| * | | | | | | Ensure only one future is created for each doc_itemGravatar Numerlor2020-12-15-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously in case get_markdown for an item ran twice, the one that ran second would overwrite the future created by the first one, potentially causing the coro to wait for it infinitely as _parse_queue would only be able to set the last future
| * | | | | | | Remove internal CachedParser result cacheGravatar Numerlor2020-12-15-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We no longer need to keep the items around since everything is in redis and the costs of always going through redis is fairly small
| * | | | | | | Use global bot http_session instead of parameterGravatar Numerlor2020-12-15-14/+13
| | | | | | | |
| * | | | | | | Merge remote-tracking branch 'upstream/master' into doc-impGravatar Numerlor2020-12-11-1635/+2259
| |\ \ \ \ \ \ \
| * | | | | | | | Restructure doc cache to handle caches of whole pagesGravatar Numerlor2020-12-11-61/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we used packages as the top level keys and fields contained the url and the symbol id, however if we want to store all symbols from fetched pages instead of only the ones that were fetched by the users this comes worse off than using the page url in the field and setting EXPIREs for them instead of doing it manually in python. The new implementation uses package:url as the redis key and only the symbol id for field names, with the expire being set to a week on the key, this means we have to pattern match the keys when deleting the cache for a package but that's being done far less than the expire checking done previously.
| * | | | | | | | Create a generator instead of returning a listGravatar Numerlor2020-12-09-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The result of _split_parameters is only iterated over, so a list is not needed. Making it lazy may also save some time in cases where we don't use all parameters
| * | | | | | | | Merge current_search and expected_end inGravatar Numerlor2020-12-09-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The two variables were initialized and cleared together and contained related information
| * | | | | | | | Improve handling of stringsGravatar Numerlor2020-12-09-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the code assumed ' and " can be used interchangeably, and strings that were inside of brackets were ignored for depth but their contents weren't causing strings like "ab[cd" to increase the depth
| * | | | | | | | Remove redundant suppressGravatar Numerlor2020-11-29-2/+2
| | | | | | | | |
| * | | | | | | | Various grammar and sentence structure changesGravatar Numerlor2020-11-29-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | Clear up docstring so it doesn't rely on private attributeGravatar Numerlor2020-11-29-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | Use pop instead of getitem and delGravatar Numerlor2020-11-29-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: MarkKoz <[email protected]>
| * | | | | | | | Use timedelta instead of constructing duration manuallyGravatar Numerlor2020-11-29-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A newline was also added to set to keep it consistent with set_if_exists
| * | | | | | | | Ensure packages from PRIORITY_PACKAGES are directly accessibleGravatar Numerlor2020-11-15-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some packages (currently only python) should be prioritised to others, the previous cleanup didn't account for other packages loading before it which resulted in duplicate symbols getting the python prefix and the original symbols linking to most probably undesired pages
| * | | | | | | | Add command for clearing the cache of packagesGravatar Numerlor2020-11-15-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We also clear the cache when removing a package