devie

devie

Please i’ve got a Question, i’m replacing a Predictive dialer with Elixir. It has exceeded all expectations so far. However, i’m facing an issue. This piece of code works well assuming all third party dependencies work as expected,

def perform(phonebook_contacts,...) do
    alias FSModEvent.Connection, as: C
  for x <-Enum.chunk(phonebook_contacts,100,100,[]), y <- x  do 
    unless Telephony.user_balance(account_number) <= 0 do
  	Task.start_link(fn -> 
        # some background job to dailout phone number y
    end)
    # :timer.sleep(1000);
    end 
  ...

phonebook_contacts can be a list with as many as 200K Numbers
I’m using exq. If something external causes the job to fail, when it gets retried, it starts from the begining of the list, is there a way i can probably retry from the last contact where the Job failed at?

Assuming [12,34,56,78,90…]

Assuming the Job fails at 56, it restarts from 12 again, it there a way of continuing from 78,...? or a better way of handling this use case?

Showing Posts 1 to 8

mbuhot

mbuhot

If you are already using Exq, then maybe store the progress of the job in redis?

devie

devie OP

Thank you for your suggestion. Any pointers on how to do this? While i dig through the Exq documentation

Architect

Architect

Interesting. Can you please share more about your project?

devie

devie OP

@Architect It’s part of a cloud based Call Center application - Inbound,outbound,voice analytics, IVR, … This code snippet just handles the dialing of the outbound calls.

Eiji

Eiji

@devie: How about use retry library?

To save state you can use simple Agent and then skip entries based on stored information in it.

ryh

ryh

I don’t really know much about Exq, but looking at it… it doesn’t seem well-suited for what you’re trying to do. You’re redefining what Exq means by “retry”, which is “do this again with the same arguments as before as I’m expecting the same result”.

As for your idea of retry – you want to be able to start where the failure happened because starting from the beginning won’t give the same result - it has side effects! Even though you’re restarting what you think is the same job, with Exq semantics, that’s actually a new job because you want to use a different set of data.


I think there’s a better way to do this…

But first, what constitutes a failure? Is it when you receive a BGAPI error or a FreeSWITCH -ERR response or what?

Second, do you really want to start from the first job that failed? It makes more sense to me to collect every dial out that failed and then retry those specifically.

cjbottaro

cjbottaro

Or use the retryable_ex package which doesn’t use a single drop of metaprogramming or macros.

Or just use Faktory (by the author of Sidekiq) and the Elixir Faktory Client, which has retries built in.

devinit

devinit

I have the same problem, how did you answer?

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews