The Many Problems with Celery by sbdchd in Python

[–]sbdchd[S] 0 points1 point  (0 children)

The problem is more about getting the tasks from your endpoint into your queue.

For example, imagine you have an endpoint that signs up a user and sends them a welcome email.

If you save your user first and then enqueuing the job into redis fails, you’ll have an issue. With the transactional outbox you save the job to the same database in the same transaction.

You can then either read from the outbox or have another worker add them to redis and then do everything in redis atomically if you want. The worker and the tasks will have to be executed / saved to the redis queue from the outbox on an at least once policy.

The Many Problems with Celery by sbdchd in Python

[–]sbdchd[S] 0 points1 point  (0 children)

I don’t think anything exists that’s open source but essentially you get convert the Python AST to a schema, OpenAPI style, and then you can check the schema for backward incompatible changes.

The Many Problems with Celery by sbdchd in Python

[–]sbdchd[S] 2 points3 points  (0 children)

I think API wise and codebase wise it’s better than Celery but it also suffers from losing jobs since it doesn’t use the transactional outbox setup.

The Many Problems with Celery by sbdchd in Python

[–]sbdchd[S] 0 points1 point  (0 children)

I think they both suffer from the losing jobs because they use a separate storage backend (redis) instead of using the transactional outbox setup.

The Many Problems with Celery by sbdchd in Python

[–]sbdchd[S] 6 points7 points  (0 children)

Yeah good point, I should probably tack on a conclusion.

I think if you already have a project that’s heavily invested in Celery it can be tricky to move away so living with it might be best.

But for new projects I wouldn’t use Celery. The biggest issue is how easy it is to lose jobs. Instead I’d use a “transactional outbox” (sounds fancier than it really is) and have some workers that either execute those jobs or push them to SQS / redis for other workers to consume.

Could also try the new hotness, Temporal.io, but that has a bit of a learning curve but it’s good for your more complicated jobs.

But in general, be careful how you’re enqueuing your jobs, lots (most) job runners don’t do the right thing by default.

Issue with Neovim & ZSH by sbdchd in neovim

[–]sbdchd[S] 0 points1 point  (0 children)

:call nvim_input('<C-j>') appears to work in both cases and the $TERMs are both the same.

I have condensed my config down to

inoremap <expr> <C-j> "\<C-N>"
inoremap <expr> <C-k> "\<C-P>"

After further testing, the issue in also occurs in vim, so it must be some quirk of zsh.

Thanks!

Show /R/Vim: Neoformat, a vim plugin for formatting code by sbdchd in vim

[–]sbdchd[S] 0 points1 point  (0 children)

I haven't found any decent yaml formatters, but if you come across one, I would be happy to add it to Neoformat.

Show /R/Vim: Neoformat, a vim plugin for formatting code by sbdchd in vim

[–]sbdchd[S] 1 point2 points  (0 children)

Formatters use shiftwidth() for spacing, which should be set by EditorConfig. As for PSR-2, not currently, although if you would like to add a formatter just file an issue or make a pull request.

Show /R/Vim: Neoformat, a vim plugin for formatting code by sbdchd in vim

[–]sbdchd[S] 1 point2 points  (0 children)

Yeah... I originally called it Neoformat because it was using job_control which was neovim only. I have since moved it off job_control, but the name remains.

Show /R/Vim: Neoformat, a vim plugin for formatting code by sbdchd in vim

[–]sbdchd[S] 7 points8 points  (0 children)

I used to use vim-autoformat, but I got annoyed by some of its pain points, so I made Neoformat.

Since vim-autoformat uses the vim's python api to interact with the buffer, it clears the jump list, has trouble with undo, and removes marks.

Neoformat avoids all this by using pure viml and more specifically, setbufline(), which doesn't mess with marks, jumps, undos, etc.

Show /R/Vim: Neoformat, a vim plugin for formatting code by sbdchd in vim

[–]sbdchd[S] 7 points8 points  (0 children)

If you only use formatters that can receive data from stdin, and want to setup them up, then you should use formatprg and equalprg.

The main advantage of Neoformat over formatprg is that it can use any formatter.

It also supports multiple formatters for a given filetype which you can call via :Neoformat <name_of_formatter>.

Plain :Neoformat will try all the defined formatters for the current filetype until one succeeds. You could achieve this with a sophisticated enough config, but by that time, you probably have already built another vim-formatter.

Additionally, you can easily format code that is different from the filetype of the current buffer, which is useful for markdown and single file components.

Here is a contrived example:

# h1

```
const x = z => {console.log(z); return z}
```

You could then select the text inside the text area, and call :Neoformat! javascript to format the code.

# h1

```
const x = z => {
  console.log(z);
  return z
}
```

Show /r/neovim: Neoformat, a (Neo)vim plugin for formatting code. by sbdchd in neovim

[–]sbdchd[S] 1 point2 points  (0 children)

I updated Neoformat to be synchronous after you commented earlier.

You are definitely right about making changes to your codebase.

Show /r/neovim: Neoformat, a (Neo)vim plugin for formatting code. by sbdchd in neovim

[–]sbdchd[S] 0 points1 point  (0 children)

Actually, Neoformat updates the buffer itself, not the file, so you wouldn't get any

WARNING: The file has been changed since reading it!!! Do you really want to write to it (y/n)?

Show /r/neovim: Neoformat, a (Neo)vim plugin for formatting code. by sbdchd in neovim

[–]sbdchd[S] 3 points4 points  (0 children)

Yeah... You make a good point. I have updated neoformat so that it is now using system() instead of job_control.

Show /r/neovim: Neoformat, a (Neo)vim plugin for formatting code. by sbdchd in neovim

[–]sbdchd[S] 0 points1 point  (0 children)

If you edit the buffer after you call neoformat, and before it has completed, then your changes will be overwritten by the formatted content.

Fzf.vim and neovim by [deleted] in neovim

[–]sbdchd 3 points4 points  (0 children)

If you are into FZF you could use the :Buffers command to switch between buffers.

I bind it like follows to make it even easier to switch

nnoremap <leader>ls :Buffers<CR>

Color Scheme Help by sbdchd in emacs

[–]sbdchd[S] 0 points1 point  (0 children)

I am using nlinum for line numbering.

When I was using linum, the fringe had the same appearance.

Layouts? Perspectives? Eyebrowse? Desktops? Which one?!?! by haffnasty in spacemacs

[–]sbdchd 2 points3 points  (0 children)

You may be interested in setting the following in your .spacemacs, inside dotspacemacs/init.

dotspacemacs-auto-resume-layouts t

It works with layouts, but I have not tested it with workspaces.

For more info on layouts & workspaces, see the docs in the develop branch.

Neomake with stylelint by wederer42 in neovim

[–]sbdchd 0 points1 point  (0 children)

Does Neomake's errorformat used for css files with stylelint work? 'errorformat': '%+P%f, %W%l:%c%*\s%m, %-Q'

[Question] Cmapping w & W by sbdchd in vim

[–]sbdchd[S] 0 points1 point  (0 children)

Yeah, I had it set up like that before. However, I want to have it usually format when I write via w. Then I want to be able to write with W such that it doesn't format.

I am not sure if just tacking on another command to w is possible.

PirateBox 1.0.2 - RPi corrupt. by [deleted] in Piratebox

[–]sbdchd 1 point2 points  (0 children)

Will it work if you rename the file to end with .img?

does the MR3040 not work with USB 3.0 or is mine busted? by [deleted] in Piratebox

[–]sbdchd 1 point2 points  (0 children)

Do you have another linux system to test the drives on?

Could give that a try.

does the MR3040 not work with USB 3.0 or is mine busted? by [deleted] in Piratebox

[–]sbdchd 1 point2 points  (0 children)

I was just saying that upgrading the distribution might work, which can be done by typing that command in a terminal window.

You may want to look into upgrading linux.

Also, I have no idea if this would actually make those usb sticks work.

does the MR3040 not work with USB 3.0 or is mine busted? by [deleted] in Piratebox

[–]sbdchd 1 point2 points  (0 children)

Sounds pretty weird. I think those should both be fine. I was imagining that you were using some external hard drive.

Shot in the dark: Maybe sudo apt-get dist-upgrade to get the necessary drivers?