Long Reports - Is this still up to date?



  • I need to adapt my server to do longer reports and I came across this nice old blog post that was made in 2015.

    However, I'm not sure if I applied the directions correctly, or if the key names are correct. I am declaring my config and passing it in as follows. However, I'm not sure if "tasks" as listed in the article should be "scripts" in mine, for instance, or what the meaning of "dedicated-process" might be in contrast with "http-server".

    I think this config is wrong. can anyone help me out?

    let config = {
      extensions: {
        scripts: {
          timeout: 600000,
          strategy: 'http-server',
          allowedModules: '*',
        },
      },
      httpPort: process.env.PORT || 5488,
      store: {
        provider: 'fs',
      },
      blobStorage: {
        provider: 'fs',
      },
      allowLocalFilesAccess: true,
      templatingEngines: {
        timeout: 600000,
        strategy: 'http-server',
      },
      chrome: {
        timeout: 600000,
      },
      tasks: {
        timeout: 600000,
        strategy: 'dedicated-process',
        forkOptions: {
          execArgv: ['--max-old-space-size=4096'],
        },
      },
      phantom: {
        timeout: 600000,
      },
      express: {
        renderTimeout: 600000,
      },
    }
    
    async initJsr() {
      let jsr = require('jsreport')(config);
      return jsr
        .init()
        .then(() => {
          // running
          console.log('jsreport instance started successfully');
          console.log('using extensions:', config.extensions);
        })
        .catch(e => {
          // error during startup
          console.error(e.stack);
          process.exit(1);
        });
    }
    

  • administrators

    hi!

    However, I'm not sure if I applied the directions correctly, or if the key names are correct. I am declaring my config and passing it in as follows. However, I'm not sure if "tasks" as listed in the article should be "scripts" in mine".

    you just need to update some properties names in configuration regarding to what is mentioned in the article. about the tasks property, then you should add to values in templatingEngines if you want to increase limits for template rendering + helpers execution, or you should add those values in extensions.scripts if you want to increase limits about jsreport scripts execution.

    or what the meaning of "dedicated-process" might be in contrast with "http-server"

    the only difference is that with http-server strategy there is pool of workers that will be reused for template rendering and scripts execution tasks. with dedicated-process it means that each of these tasks will be done creating a new child process for each of them.

    I think this config is wrong. can anyone help me out?

    this is an updated configuration:

    {
      httpPort: process.env.PORT || 5488,
      allowLocalFilesAccess: true,
      templatingEngines: {
        timeout: 600000,
        strategy: 'http-server',
        forkOptions: {
          execArgv: ['--max-old-space-size=4096'],
        }
      },
      extensions: {
        scripts: {
          timeout: 600000
        },
        express: {
          renderTimeout: 600000,
        }
      },
      store: {
        provider: 'fs',
      },
      blobStorage: {
        provider: 'fs',
      },
      chrome: {
        timeout: 600000,
      },
      phantom: {
        timeout: 600000,
      }
    }
    

Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.