##// END OF EJS Templates
caches: use individual namespaces per user to prevent beaker caching problems....
caches: use individual namespaces per user to prevent beaker caching problems. - especially for mysql in case large number of data in caches there could be critical errors storing cache, and thus preventing users from authentication. This is caused by the fact that we used single namespace for ALL users. It means it grew as number of users grew reaching mysql single column limit. This changes the behaviour and now we use namespace per-user it means that each user-id will have it's own cache namespace fragmenting maximum column data to a single user cache. Which we should never reach.

File last commit:

r552:9a0f45b0 default
r2591:36829a17 stable
Show More
extensions.rst
58 lines | 2.0 KiB | text/x-rst | RstLexer
dan
docs: updated docs for integrations, fixes #4137...
r552 .. _dev-plug:
Developing Plugins/Extensions
-----------------------------
An Extension or a Plugin is simply a |PY| module with a ``run`` method that
expects a number of parameters, depending on which event it is listening
for. To get an extension working, use the following steps:
1. Create an extension or plugin using the below example.
2. Save the plugin inside the
:file:`/home/{user}/.rccontrol/{instance-id}/rcextensions` folder.
3. Add a hook to the
:file:`/home/{user}/.rccontrol/{instance-id}/rcextensions/__init__.py` file.
For more information, see :ref:`event-listener`.
4. Restart your |RCM| instance.
Extension example
^^^^^^^^^^^^^^^^^
In the following example, the ``run`` method listens for a push to a |repo|
and parses the commit.
.. code-block:: python
def run(*args, **kwargs):
revs = kwargs.get('pushed_revs')
if not revs:
return 0
from rhodecode.lib.utils2 import extract_mentioned_users
from rhodecode.model.db import Repository
repo = Repository.get_by_repo_name(kwargs['repository'])
changesets = []
reviewers = []
# reviewer fields from extra_fields, users can store their custom
# reviewers inside the extra fields to pre-define a set of people who
# will get notifications about changesets
field_key = kwargs.get('reviewers_extra_field')
if field_key:
for xfield in repo.extra_fields:
if xfield.field_key == field_key:
reviewers.extend(xfield.field_value.split())
vcs_repo = repo.scm_instance_no_cache()
for rev in kwargs['pushed_revs']:
cs = vcs_repo.get_changeset(rev) # or get_commit. See API doc
cs_data = cs.__json__()
cs_data['mentions'] = extract_mentioned_users(cs_data['message'])
cs_data['reviewers'] = reviewers
# optionally add more logic to parse the commits, like reading extra
# fields of repository to read managers of reviewers
changesets.append(cs_data)
return changesets