1 # The contents of this file are subject to the Common Public Attribution
2 # License Version 1.0. (the "License"); you may not use this file except in
3 # compliance with the License. You may obtain a copy of the License at
4 # http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
5 # License Version 1.1, but Sections 14 and 15 have been added to cover use of
6 # software over a computer network and provide for limited attribution for the
7 # Original Developer. In addition, Exhibit A has been modified to be consistent
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
12 # the specific language governing rights and limitations under the License.
14 # The Original Code is reddit.
16 # The Original Developer is the Initial Developer. The Initial Developer of
17 # the Original Code is reddit Inc.
19 # All portions of the code written by reddit are Copyright (c) 2006-2015 reddit
20 # Inc. All Rights Reserved.
21 ###############################################################################
23 from pylons
import app_globals
as g
25 from r2
.lib
import amqp
26 from r2
.lib
.hooks
import all_hooks
, get_hook
27 from r2
.models
.trylater
import TryLater
34 our_hooks
= (key
[len(PREFIX
):] for key
in all_hooks().keys()
35 if key
.startswith(PREFIX
))
36 with TryLater
.multi_handle(our_hooks
) as handleable
:
37 for system
, data
in handleable
.iteritems():
38 hook_name
= "trylater.%s" % system
39 g
.log
.info("Trying %s", system
)
41 get_hook(hook_name
).call(data
=data
)