Why my cron breaks the cron shedule?

I have this in my module. Minute I clear the chache it starts running on every request.
Yes, on every request on the site, this cron is executing. No matter what cron shedule I have set in Home > Administration > Configuration > System

function module_cron()
    $state = Drupal::state();
    $d= $state->get('module_d_last');

    $requestTime = Drupal::time()->getRequestTime();

    if (($requestTime - $d) > 172800) {
        $dicService = Drupal::service('module.term.service');
        $state->set('module_d_last', $requestTime);

    // If the minimum sitemap lifetime hasn't been passed, skip.
    $lifetime = $requestTime - $state->get('module_sitemap_queue_last');
    if ($lifetime < 172800) { //1day
        Drupal::logger('cron')->alert('No need to run cron '. $lifetime);

    // Long-running operation example, leveraging a queue:
    // Queue news feeds for updates once their refresh interval has elapsed.
    $queue = Drupal::queue('module_sitemap_queue');
    $dicService = Drupal::service('module.term.service');
    $nodesChunks = $dicService->getNodes('my_content', ('status' => NodeInterface::NOT_PUBLISHED), true);

    $i = 0;
    foreach ($nodesChunks as $index => $nodes) {
        $data = ('number' => $i, 'nodes' => $nodes, 'chunks' => count($nodesChunks));


Because of this lots of other cron are never run. I believe this cron makes all other cron wait.

Any suggestions?

bootstrap_barrio subtheme breaks ckeditor’s media insert in custom block

I’m facing this problem (seems to be producible) in a contrib theme that breaks the ckeditor media insert button on custom blocks in the layout builder of individual nodes…
The javascript error says it’s typically caused by the theme neglecting to include proper html attributes for that entity type, but the theme’s block.html.twig is identical to that template in Bartik. This is a custom subtheme of bootstrap_barrio created with the shell script provided by bootstrap_sass (Barrio highly recommends subtheming that way). Error has been repeated on new D8 and D9 installations, and the full message on page load is:

Uncaught Error: Quick Edit could not associate the rendered entity field markup (with (data-quickedit-field-id="block_content/1/body/en/full")) with the corresponding rendered entity markup: no parent DOM node found with (data-quickedit-entity-id="block_content/1"). This is typically caused by the theme's template for this entity type forgetting to print the attributes.

and while editing a block in the layout builder, clicking ckeditor’s media insert button results in the following error (and the media dialog never opens, the “Loading…” message appears but nothing loads):

Object { message: "nAn AJAX HTTP error occurred.nHTTP Result Code: 500nDebugging information follows.nPath: /media-library?media_library_opener_id=media_library.opener.editor&media_library_allowed_types%5B0%5D=image&media_library_selected_type=image&media_library_remaining=1&media_library_opener_parameters%5Bfilter_format_id%5D=basic_html&hash=Ul_KDXiNyg8Mw95OeXpaIZUYieACO4FlRCUQkle_TCsnStatusText: Internal Server ErrornResponseText: The website encountered an unexpected error. Please try again later.", name: "AjaxError", stack: "@https://atn.ddev.site/core/misc/ajax.js?v=8.9.3:100:32n@https://atn.ddev.site/core/misc/ajax.js?v=8.9.3:643:3n" }

I was very excited about the bootstrap_barrio’s subtheme with sass, gulp, browsersync all configured with bootstrap, but maybe I should switch to radix? I’d much prefer to solve this error though, if anyone has any insight? I don’t know where to begin with javascript debugging 🙁

vim – Invoking vi through find | xargs breaks my terminal. Why?

When you invoke a program via xargs, the program’s stdin (standard input) points to /dev/null. (Since xargs doesn’t know the original stdin, it does the next best thing.)

$ true | xargs filan -s
    0 chrdev /dev/null
    1 tty /dev/pts/1
    2 tty /dev/pts/1

$ true | xargs ls -l /dev/fd/

Vim expects its stdin to be the same as its controlling terminal, and performs various terminal-related ioctl‘s on stdin directly. When done on /dev/null (or any non-tty file descriptor), those ioctls are meaningless and return ENOTTY, which gets silently ignored.

  • My guess at a more specific cause: On startup Vim reads and remembers the old terminal settings, and restores them back when exiting. In our situation, when the “old settings” are requested for a non-tty fd (file descriptor), Vim receives all values empty and all options disabled, and carelessly sets the same to your terminal.

    You can see this by running vim < /dev/null, exiting it, then running stty, which will output a whole lot of <undef>s. On Linux, running stty sane will make the terminal usable again (although it will have lost such options as iutf8, possibly causing minor annoyances later).

You could consider this a bug in Vim, since it can open /dev/tty for terminal control, but doesn’t. (At some point during startup, Vim duplicates its stderr to stdin, which allows it to read your input commands – from a fd opened for writing – but even that is not done early enough.)

theming – CSS styling breaks field hide mechanism

I have some jquery set up to hide a radio list field when the user clicks on an adjacent field. I’m trying to style the radio list to display horizontally, but it breaks the jquery. I believe this happens because I am declaring the display value for the radio list in CSS, which overrides the hide function in the code.

The jquery looks like this:

      // apply event handler to radio inputs
      $('.main-field input').change(function(){
        // if 1 or more YES selections are found
        if($('.main-field input:checked').length > 0){
          // hide submit button
        // otherwise
          // show submit button

The css portion to style the radio list currently includes this:

.radio-list-item-wrapper {
    display: inline;
    margin: 10px 1em;
    padding: 0;
    list-style: none;
    position: relative;

I have tried using flex instead of inline, but that doesn’t work either. None of the other attributes affect functionality.

Is there a way to display a radio list horizontally without declaring the display: inline/flex attribute, or perhaps a different approach that gets me the display I want without breaking the jquery code?

This is for a Drupal 7 site.

Count number of line breaks in Google Sheets cell

my spreadsheet looks like this:

Is there a way with a formula to get in the B row the number of lines (including line breaks) as you see in the picture below?


magento2 – After update to 2.4.0 view invoice in backend breaks page (layout will not load)

i have a problem since we have updated our Magento from 2.3.5 to 2.4.0.

Here is the problem:
We will open the invoice view in backend. So we go to:
->Sales->orders->select an order (my order: DE001014408) ->go to Invoices->view

The page loads everything without layout:
view without layout

But if i view another invoice of another order, everything is working fine. In Example order DE001014405. Here is how it should looks like:
Works as expected

As i can see in inspektor-mode, there is an error:

Uncaught ReferenceError: require is not defined
-anonymous- https://-domain-/b4ckend/sales/order_invoice/view/invoice_id/21960/key/688e4aa0e262928d72e73f12a23c94bda39d68a1564ed3fadb0b3f96ee77b15c/:297

After that i checked the logs. The logs says:

main.CRITICAL: Cannot gather stats! Warning!stat(): stat failed for /home/dev/domains/-domain-/public_html/pub/static/frontend/-theme-/-theme-child-/en_US/mage/requirejs/mixins.js {“exception”:”(object) (MagentoFrameworkExceptionFileSystemException(code: 0): Cannot gather stats! Warning!stat(): stat failed for /home/dev/domains/-domain-/public_html/pub/static/frontend/-theme-/-theme-child-/en_US/mage/requirejs/mixins.js at /home/dev/domains/-domain-/public_html/vendor/magento/framework/Filesystem/Driver/File.php:77)”}

I also searched the forum and tried some solutions:

  1. Checked .htaccess
  2. checked file permissions
  3. run content deploy and also set developer mode to deploy automatically
  4. deleted .htaccess in pub/media
  5. cleared and flushed cache

Nothing seems to be working. I think that it is not a permission or htaccess problem because some invoices can be viewed without issues.

It is a known Magento bug which will be fixed in a coming update like 2.4.1 or later?

Does someone has the same issue and were able to fix it? Any ideas how to fix it?

I am happy for any ideas!

Thanks for helping.

Why wont the product description attribute, when set to TextArea, convert line breaks to

Magento v2.4.2

My product description attribute was set to TextArea, and its worked fine for the last year. New lines where rendered as
in HTML on the product page. I decided to change it to TextEditor so I can use HTML. I didnt realize when I did that, all my non HTML descriptions would lose all their formatting and new lines or line breaks would no longer render as
and my descriptions would look like one giant run on paragraph.

So I changed the attribute back to TextArea thinking it would revert back. It didnt. There is still new line or line breaks in all the product descriptions, so the data is still here. Its just not rendering like it used to.

I have cleared the cache, redeployed etc etc…any ideas?

google sheets – Array formula-ing this formula breaks it…any ideas why?

I have a spreadsheet with SheetA and SheetB. I’m trying to pull into SheetA some of the columns of each row in SheetB where the date in Column I of SheetB is earlier than today.

This formula on a single row works:


But if I try to make it an array formula and apply it to a range, it stops working. E.g.,:


The way it stops working is it seems to no longer care about the <=TODAY part and starts to pull in rows seemingly at random—rows where the cell value in ‘I’ is blank, where it’s a date greater than today, etc.

Any ideas what I’m doing wrong?

Thank you!

Is it possible that Google Docs does not show page breaks on the screen?

I use Google Docs to keep some notes, and would 99% or 100% not print it out ever. So I hope to see the pages on the screen just as one continuous scroll, or without the page breaks. Is that possible?

I can set the View -> Print Layout to off, but that will still show the page breaks. The main problem with this is, when the document is a whole table, the page break may appear as row border, so it is hard to tell where the row border is actually at. Some workers may report something to their clients, saying the end of the data is at that page border line, not know the actually row spans to the next page.

keyboard – Autohotkey – GetKeyState breaks if a new key is pressed

I’m trying to create a script that presses the space button, as long as it is physically pressed.
By example, if I hold down the space bar, the script would replicate spaces with Send. As soon as I release the spacebar, it stops sending space.
I’ve achieved this with this script

#SingleInstance Force
SendMode Input
loop {
    if (GetKeyState("Space"))
        Send {Space down}
        Random, r, 5, 15
        Sleep, %r%
        Send {Space up}
    Random, r, 5, 10
    Sleep, %r%

This works, however, if I press a new key while pressing the Space button, the GetKeyState("Space") would return false for some reason.
The script currently starts properly, but pressing any other key is the same as releasing the spacebar, which is not what I want.

So then I thought, maybe Input can help me. Well, again, it worked, but as soon as I pressed a different key, it would stop.

Here’s what I tried with Input that produced the same results, relatively (with offsets in timing) from the first sample I tried.

#SingleInstance Force
SendMode Input
loop {
    Input, OutputVar, B I L4 T0.05 V ; Had to keep it a low timeout due to the nature of the script
    if (InStr(OutputVar, Chr(32)))
        Send {Space down}
        Random, r, 5, 15
        Sleep, %r%
        Send {Space up}
    Random, r, 5, 10
    Sleep, %r%

This also fails because pressing a new key internally releases my spacebar from being pressed.

I’d try to do keybind events like Space::, but it would also be fired from the Send commands, creating an infinite loop. And I wouldn’t want to press any other key than space, as several of my keys are binded to something or another.

It feels like filter keys, or sticky keys, because even without autohotkey, the spacebar releases after pressing any other key. But both of those features are turned off. And it’s not just the spacebar. Any held key is released as soon as a new key is pressed. Filter keys does exactly what I’m trying to prevent, but there’s no ‘reverse filter keys’ so to speak. Is it possible to get by with this hardware limitation? How can I have autohotkey work in the sense where it see’s that I’m holding space, even after a new key has been pressed?