Commit Graph

274 Commits

Author SHA1 Message Date
Tim Abbott cd2348e9ae Run queue processers multithreaded in development.
This change drops the memory used for Python processes run by Zulip in
development from about 1GB to 300MB on my laptop.

On the front of safety, http://pika.readthedocs.org/en/latest/faq.html
explains "Pika does not have any notion of threading in the code. If
you want to use Pika with threading, make sure you have a Pika
connection per thread, created in that thread. It is not safe to share
one Pika connection across threads.".  Since this code only connects
to rabbitmq inside the individual threads, I believe this should be
safe.

Progress towards #32.
2016-03-20 18:04:24 -07:00
Eklavya Sharma 851b0a871d Fix python 3 decode error in zerver/tests.py.
Refer to #256.
2016-03-19 15:46:18 -07:00
Tim Abbott 1d008576f2 QueueProcessingWorker: Add stub consume function and queue_name.
QueueProcessingWorker will now throw errors if there's a misconfigured
queue processor.
2016-02-03 19:47:14 -08:00
Tim Abbott 5bacda3662 python3: Fix usage of .keys()/.values() to handle iterators.
This fixes the places where we use the result of .keys(), .items(),
and .values() that wouldn't work with an iterator to wrap them with
list().
2016-01-26 21:11:25 -08:00
Tim Abbott f6f8f1fe36 Use new-style classes consistently for Python 3 support.
Also add the fixer for this to our list of fixers we check.
2015-11-04 08:01:52 -08:00
Tim Abbott f3783fb4a1 Apply Python 3 futurize transform libfuturize.fixes.fix_print_with_import. 2015-11-01 09:26:16 -08:00
Kara McNair 8e429759e2 Replace 'flaky' and 'freaking out' with less personified words.
The tests to recognize a misbehaving/unpredictable worker task use
the words 'flaky' and 'freaking out' in personifying the system
behavior. This terminology isn't inclusive of people with
mental health issues or mood disorders, so this change updates
the wording to have less personification and more objective system
description. (http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1925070/)
2015-10-26 20:14:48 -07:00
Tim Abbott 32aea4c9dd Fix get_unique_open_realm always returning None in production.
Fixes #186.
2015-10-15 10:21:04 -04:00
Tim Abbott 71a06d58de Convert uses of Realm.objects.get() to get_realm().
get_realm is better in two key ways:
* It uses memcached to fetch the data from the cache and thus is faster.
* It does a case-insensitive query and thus is more safe.
2015-10-15 09:16:58 -04:00
Tim Abbott 51ed5028dc Remove unnecessary get_realm_name function. 2015-10-15 09:16:58 -04:00
Reid Barton 9db521a931 Django 1.8 compatibility: extracting the user from a session
django commit 596564e80808 stores the user id in the session as a
string, which broke our code that extracts the user id and compares
it to the id of a UserProfile object.

(imported from commit 99defd7fea96553550fa19e0b2f3e91a1baac123)
2015-08-20 23:15:45 -07:00
Jason Michalski 802a3dd357 Enable missed message notifications for zulip.com
Also increase the number of messages sent as context from 5 to 10 and
look up to 15 minutes in to the past for context.

(imported from commit bfaed9bcff1ee2047fc3b7a63acf93cd2d47cc7d)
2015-02-20 21:13:36 -05:00
Jason Michalski 2c1ef7d89e Remove failing missed message test
We disabled missed messages for the zulip realm and this test was
failing.

(imported from commit c37d301ac98c38495ff16e95d773f3d6d700772d)
2015-02-07 18:16:12 -08:00
Jason Michalski 748fb9afe5 Add avatar_url to v1/users
(imported from commit c89b85e1826dc3fbfdd65ec0529dd364b5e463d5)
2014-07-29 21:46:35 -07:00
Jason Michalski 710a802f49 Add context to at mention missed messages
When you are at mentioned in a stream we will now send you up to the
last five messages which were sent in the past 5 minutes on the same
topic and stream.

(imported from commit 6df6c1cf868722a7bf76e54710e38741a7ac8f31)
2014-07-15 20:21:28 -07:00
Jason Michalski 3f6e53db6e Add bot_data module that updated with events
(imported from commit b0bd714258132fc81db763d316a15f5a81b1f4ff)
2014-03-05 14:16:20 -05:00
Jason Michalski c17ed8dc8c Add bots to page_params and send events on bot creation
(imported from commit ce418b4f056576d57f82d26af621473c730c12d8)
2014-03-05 14:16:19 -05:00
Jason Michalski 846dfd5105 Update patch bot API to support setting stream defaults
Adds APIs edit a bot's default_to_stream, default_events_register_stream
and default_all_public_streams.

(imported from commit c848a94b7932311143dad770c901d6688c936b6d)
2014-03-05 14:16:18 -05:00
Jason Michalski 50db83508b Add API support for setting defaults in the add bot API
Support setting default_to_stream, default_events_register_stream, and
default_all_public_streams during in the bot creation API.

(imported from commit bef484dd8be9f8aacd65a959594075aea8bdf271)
2014-03-05 14:16:18 -05:00
Jessica McKellar 87635b9e32 Convert settings from static HTML to a template.
This will make life much easier for handling update events.

(imported from commit 66b101eb5fae89b4eec6fc797fee8be26ac99bfb)
2014-03-03 16:08:32 -05:00
Jessica McKellar e0bd15669a Don't post checkbox data directly to /json/notify_settings/change.
They have weird properties like not sending anything for unchecked
boxes, which makes it hard to wrap a client-agnostic API around.

(imported from commit fef73a57a55b218b55dab6be3453dd6eac73c789)
2014-03-03 16:08:32 -05:00
Jason Michalski 0244b50f0b Split bot deactivation from user deactivation
(imported from commit 153a870b244e040e3b5976f639866dbace5563f6)
2014-02-18 15:09:22 -05:00
Jason Michalski d177f49a96 Change the create bot API to use rest_dispatch
(imported from commit 0fac290be2ed04178c4df866f5bc958441b2d320)
2014-02-18 15:09:20 -05:00
Jason Michalski 9d973ff106 Change get_bots API to use rest_dispatch
(imported from commit 921895dd636ba118a0f57e60a7bcb9dca1c7c605)
2014-02-18 15:09:19 -05:00
Steve Howell 8bae4d746d Remove unused json_to_list function.
(imported from commit 9da59ee4edd3c569f798710267db5400b9abdb30)
2014-02-18 14:24:04 -05:00
Steve Howell 4bc76b2d6d Handle more types of data in extract_recipients.
We now allow the list of recipients to be sent as a
comma-delimited string with optional JSON encoding.

(imported from commit e928b037bbd258348eb5b2ecca486d0bb77f593e)
2014-02-18 14:24:04 -05:00
Steve Howell 6edb758136 Add test_extract_recipients.
(imported from commit 13a5d1287fd489664c7f667d5b75a513f5f744c1)
2014-02-18 14:24:03 -05:00
Steve Howell b35b3e584c Move some tests into test_unread.py
(imported from commit 64ed0aa6766462f0d56192ddbf68c09b283cee56)
2014-02-10 13:23:27 -05:00
Steve Howell 639a39aace Move some code into test_decorators.py
(imported from commit 7133c0fe1ae3028098b72ac4e14693e540aac4d7)
2014-02-10 13:23:27 -05:00
Steve Howell b8b2551e60 Split out test_events.py from tests.py.
(imported from commit a6bfe7db506821fa4747d8bf2ae2af2f4280788d)
2014-02-01 08:14:50 -05:00
Steve Howell 3287169771 Split out test_bugdown.py from tests.py.
(imported from commit 56b67ac630aec42518b946032e594bc251259f38)
2014-01-31 17:47:21 -05:00
Steve Howell f42b526749 Create test_signup.py.
(imported from commit 4dffbed84fbe60d5f5deaedfb614e4eb156b34c7)
2014-01-31 16:02:35 -05:00
Steve Howell c67ae498ff Extract test_external.py
(imported from commit 838dd34f101025ba161291992a56972cd374104b)
2014-01-31 13:14:19 -05:00
Steve Howell 5acf8ac0b6 Split out zerver/test_messages.py.
(imported from commit 61c40418bad4628a8f98298587a0e0defa9302bd)
2014-01-31 11:22:49 -05:00
Steve Howell 6a327a2a9c Reorganize imports to minimize vertical space.
After extracting test_subs.py, I went back and tried to put as may
imports on a single line as possible without going over 80 chars.
I did this for the zerver.lib.actions section in tests.py too, where
some imports had been removed.

(imported from commit 6ec5bad0a5314aed597f3c55aaf31611598b84ff)
2014-01-29 17:22:30 -05:00
Steve Howell 27aeebddb7 Extract test_subs.py
(imported from commit 9400eb56bce5b180c7c8ce3837906640ac80eef5)
2014-01-29 17:22:29 -05:00
Tim Abbott 7151af5119 Fix disabling of markdown for mit.edu.
(imported from commit 952456ddab8112bf62e6d17e29325c6d974be7a5)
2014-01-29 14:39:53 -05:00
Steve Howell 233ce4360f Handle realm_name in fetch_initial_state_data/apply_events.
Instead of having home() set page_params.realm_name directly from
the user_profile object, have fetch_initial_state_data() set it.
This is more consistent with how we treat other data, and it protects
us against a race condition where realm name updates arrive during
the DB fetching.

(imported from commit 545e3bd73f150438126e3f941e9bebc7aa1d0614)
2014-01-29 13:37:58 -05:00
Jessica McKellar da3fc3fede Add tests for stream deletion.
(imported from commit bfe52c6c5be3fc36907071f9ff096cf74aa9fb22)
2014-01-29 13:09:50 -05:00
Jason Michalski de522029d5 Switch to DiscoverRunner from DjangoTestSuiteRunner
(imported from commit 77dd694b20509bfdc7327186e0524d686f0415f7)
2014-01-29 11:34:31 -05:00
Jason Michalski a028bda264 Allow up to three twitter previews per message
(imported from commit 566b786f9ac0582f15f8f77363f63932ee5ceec8)
2014-01-29 11:00:41 -05:00
Steve Howell 582f7eb24d Extract test_hooks.py.
These classes are in test_hooks.py now.  They still run as part of
the regular suite, so this is just to make it easier to navigate the
files.

  JiraHookTests
  BeanstalkHookTests
  GithubV1HookTests
  GithubV2HookTests
  PivotalV3HookTests
  PivotalV5HookTests
  NewRelicHookTests
  StashHookTests
  FreshdeskHookTests
  ZenDeskHookTests

(imported from commit 26a9572dd5170f9516e739d587a119bd1f87959a)
2014-01-29 10:56:00 -05:00
Steve Howell 58ca46530e Remove unused API_KEYS var.
(imported from commit cfffdd9ea4a2e4a54f9483f57cc87fa9857f098b)
2014-01-29 10:55:59 -05:00
Steve Howell 12c095fd4b Extract test_runner.py
The file test_runner.py has our subclass of DjangoTestSuiteRunner
and various methods that help it work.

(imported from commit 8eca39a7ed3f8312c986224a810d4951559e7a8b)
2014-01-29 10:55:59 -05:00
Steve Howell 5ba716cf42 Add test_admin_restrictions_for_changing_realm_name().
(imported from commit 3c6d9482fc6a0321d1584a653edd94475e92129e)
2014-01-29 10:16:58 -05:00
Steve Howell 1b987b0803 Add API for changing realm names.
(imported from commit 4bc117ae2ca4acb8896b45cd7058556317287ef8)
2014-01-29 10:16:57 -05:00
Steve Howell a8bf9dfaf2 Add event support to do_set_realm_name().
(imported from commit c0abac9867aa211bb03e20a5dc1378cf476619ce)
2014-01-29 10:16:56 -05:00
Steve Howell 1e948d2d51 Add do_set_realm_name/get_realm_name.
(imported from commit cf1cd9e1de1169f542e5f0690ef94a576dfd5663)
2014-01-28 17:40:01 -05:00
Steve Howell 0eed5d20d2 Create cache.flush_realm() and call it from do_deactivate_realm().
This is a slight behavior change, as we now flush user_profile
caches for bots as well as humans.

(imported from commit 24c72c44d851ee4c66a67a4728cd6c548faeedcd)
2014-01-28 17:40:00 -05:00
Jason Michalski 05e00575bb Only send stream update events to clients that need them
Stream name and descriptions updates were being sent to all of the
active users on a realm. They are now only send to users who would have
information about that stream.

(imported from commit 2621ee8029f7356bf44ec493d7b5361bd546a8f5)
2014-01-28 17:12:15 -05:00