예제 #1
0
 def entry_point(connection):
     td_interval = timedelta(seconds=10)
     worker = Worker()
     last_time = tz_now()
     while True:
         worker.processing(connection.get())
         current_time = tz_now()
         if current_time - last_time > td_interval:
             last_time = current_time
             transaction.commit()
             State.set_value('emdr-last-transaction', last_time)
             transaction.commit()
예제 #2
0
def home(request):
    if request.user.is_anonymous():
        return sign_in(request)

    active_orders = Order.objects.filter(closed_at__isnull=True)
    State.set_value('order-buy-count', active_orders.filter(bid=True).count())
    State.set_value('order-sell-count', active_orders.filter(bid=False).count())
    State.set_value('order-closed-count', Order.objects.filter(closed_at__isnull=False).count())
    return render(request, 'eve/home.html', {
        'state_list': State.objects.order_by('name'),
        })